[Scilab-users] scilab mkdir and UNC path support

classic Classic list List threaded Threaded
4 messages Options
Antoine Monmayrant-2 Antoine Monmayrant-2
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] scilab mkdir and UNC path support

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...

Thanks,

Antoine

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: scilab mkdir and UNC path support

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
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant-2 Antoine Monmayrant-2
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? scilab mkdir and UNC path support

Hello Samuel,

Well, pathconvert does not help much here (it does not change a single char to my unc path).
But anyway, it's a dead end for me: in addition to some assumptions in mkdir() that are not true with unc path, mkdir() calls a hard coded function (createdir) that I am not able to modify.
One of the issue with createdir is that it tries to determine whether a path is a local or a global one: its logic is failing with a unc path...

Too bad,

Antoine
 
 
Le Lundi, Octobre 29, 2018 19:40 CET, Samuel Gougeon <[hidden email]> 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
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant-2 Antoine Monmayrant-2
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? scilab mkdir and UNC path support

In reply to this post by Samuel GOUGEON
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 <[hidden email]> 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
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users