mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 08:53:01 -05:00
tst: passthrough-fuse: on Windows allow the --VolumePrefix option to specify path
This commit is contained in:
parent
22fccdb575
commit
3700b375a7
@ -274,31 +274,52 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (3 <= argc && '-' != argv[argc - 2][0] && '-' != argv[argc - 1][0])
|
if (3 <= argc && '-' != argv[argc - 2][0] && '-' != argv[argc - 1][0])
|
||||||
{
|
{
|
||||||
|
ptfs.rootdir = realpath(argv[argc - 2], 0); /* memory freed at process end */
|
||||||
|
argv[argc - 2] = argv[argc - 1];
|
||||||
|
argc--;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(_WIN64) || defined(_WIN32)
|
#if defined(_WIN64) || defined(_WIN32)
|
||||||
/*
|
/*
|
||||||
* When building for Windows (rather than Cygwin or POSIX OS)
|
* When building for Windows (rather than Cygwin or POSIX OS)
|
||||||
* allow the syntax C$\Path as an alternative to C:\Path. This
|
* allow the path to be specified using the --VolumePrefix
|
||||||
|
* switch using the syntax \\passthrough-fuse\C$\Path. This
|
||||||
* allows us to run the file system under the WinFsp.Launcher
|
* allows us to run the file system under the WinFsp.Launcher
|
||||||
* and start it using commands like:
|
* and start it using commands like:
|
||||||
*
|
*
|
||||||
* net use z: \\passthrough-fuse\C$\Path
|
* net use z: \\passthrough-fuse\C$\Path
|
||||||
*/
|
*/
|
||||||
if ((
|
if (0 == ptfs.rootdir)
|
||||||
('A' <= argv[argc - 2][0] && argv[argc - 2][0] <= 'Z') ||
|
for (int argi = 1; argc > argi; argi++)
|
||||||
('a' <= argv[argc - 2][0] && argv[argc - 2][0] <= 'z')
|
|
||||||
) &&
|
|
||||||
'$' == argv[argc - 2][1] &&
|
|
||||||
('\\' == argv[argc - 2][2] || '/' == argv[argc - 2][2]))
|
|
||||||
{
|
{
|
||||||
argv[argc - 2][1] = ':';
|
int strncmp(const char *a, const char *b, size_t length);
|
||||||
|
char *strchr(const char *s, int c);
|
||||||
|
char *p = 0;
|
||||||
|
|
||||||
|
if (0 == strncmp("--UNC=", argv[argi], sizeof "--UNC=" - 1))
|
||||||
|
p = argv[argi] + sizeof "--UNC=" - 1;
|
||||||
|
else if (0 == strncmp("--VolumePrefix=", argv[argi], sizeof "--VolumePrefix=" - 1))
|
||||||
|
p = argv[argi] + sizeof "--VolumePrefix=" - 1;
|
||||||
|
|
||||||
|
if (0 != p && '\\' != p[1])
|
||||||
|
{
|
||||||
|
p = strchr(p + 1, '\\');
|
||||||
|
if (0 != p &&
|
||||||
|
(
|
||||||
|
('A' <= p[1] && p[1] <= 'Z') ||
|
||||||
|
('a' <= p[1] && p[1] <= 'z')
|
||||||
|
) &&
|
||||||
|
'$' == p[2])
|
||||||
|
{
|
||||||
|
p[2] = ':';
|
||||||
|
ptfs.rootdir = realpath(p + 1, 0); /* memory freed at process end */
|
||||||
|
p[2] = '$';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ptfs.rootdir = realpath(argv[argc - 2], 0); /* memory freed at process end */
|
|
||||||
argv[argc - 2] = argv[argc - 1];
|
|
||||||
argc--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (0 == ptfs.rootdir)
|
if (0 == ptfs.rootdir)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user