[Scilab-users] ?==?utf-8?q? scilab mkdir and UNC path support

Antoine Monmayrant amonmayr at laas.fr
Sat Nov 3 10:04:29 CET 2018


Hello all,

In the end, I was not able to properly add unc support, as it implied some changes in a hard coded function (createdir).
But I managed to roll out a dirty hack that works for our lab.
For all of our machines, the user home directory comes from a remote server ( \\servernane\username\ ) and is usually also mounted as a letter drive ( let's say Z: ).
What I have done is the following:
1) I wrote a path conversion function that takes a path, and if we are on Windows, retrieves the username ( echo %username% ) and checks whether the path starts with \\someServerName\username. It it's the case, it searches the mount table (don't know the proper name in Windows parlance:  wmic LOGICALDISK LIST BRIEF ) to see whether a letter drive is associated to that unc path. If it's the case the path "\\someServerName\username\RestOfPath\" is changed into  "Z:\RestOfPath\" ( assuming Z: was the letter drive associated to the unc server address).
 2) I patched mkdir() to wrap the input path with my path conversion function.
3) I added a scilab.ini file that loads my path conversion function together with my patched mkdir function.

So far, it has worked as expected, that is I was able to use atomsInstall without any issue.
I think that more functions than just mkdir() should be patched for a proper unc path support (well "proper" as in it works in my really specific case).

If you think that what I've done might be interesting for any of you, just get in touch and I'll get into more details.

Cheers,

Antoine
 
Le Lundi, Octobre 29, 2018 19:40 CET, Samuel Gougeon <sgougeon at free.fr> a écrit: 
 
> Le 29/10/2018 à 16:17, Antoine Monmayrant a écrit :
> > Hi all,
> >
> > The lack of support for UNC path in scilab is a real issue in our lab (UNC path are Windows paths that looks like \\server\dir1\subdir1\).
> > In particular it breaks atomsInstall for all the Windows users here as our home dir is mounted as a UNC path: \\servername\username.
> > I found the main issue (I think) in mkdir() at line 88:
> >      subdirs = strsplit(NewDirectory, ["/" "\"]);
> > obviously, splitting the  path to the new directory is not going to give you something nice with a UNC path that starts with "\\".
> > I have an idea to workaround this limitation, but there is still something I don't get in the logic of mkdir(): this splitting is associated with "bAddFirstDirSep", a variable that tries to detect something wrong with the first directory separator.
> > Could anyone more knowledgeable than me explain why it is there and what is is doing?
> > I would not want to reintroduce some bug with my modified version...
> 
> On windows, we have
> --> pathconvert("c:\",%f,%t,"u")
>   ans  =
>   /cygdrive/c
> 
> I don't know what we might do with this. There is no cygdrive on my 
> computer (AFAIK :/)
> 
> Conversely, could you try something like
> --> pathconvert(your_slashslash_path, %f, %t, "w")
> 
> Samuel
> 
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>




More information about the users mailing list