On Dec 9 13:47, Federico Kircheis via Cygwin wrote: > On 09/12/2024 12.46, Corinna Vinschen via Cygwin wrote: > > On Dec 6 13:23, Federico Kircheis via Cygwin wrote: > > > Hello, > > > > > > was it considered to add a flag to cygpath to output a path in unc format? > > > > No. But it wouldn't be much work. > > It would be very nice if it ever happens. > > > > For example, the folder > > > > > > C:\test. > > > > > > cannot be accessed from many Windows applications (powershell and cmd > > > included) because of the trailing dot, while cygwin has no issue creating, > > > accessing and deleting such files/folders. > > > > > > Using an unc path > > > > > > \\?\C:\test. > > > > > > solves the issue for some programs, but cygpath currently misses an option > > > for creating such path. > > > > As a workaround you can just prepend the long path prefix: > > > > echo -n '\\?\'; cygpath ... > > Which is what I'm doing, plus special-casing > > 1) > root path, like C:\ , because for whatever reason \\?\C:\ is not valid, it > has to be a subfolder (and trying to trick it with \\?\C:\\ does not work > either).
In which scenario? \\?\C:\ is just the same as \??\C:\ in NT speak, and that's a perfectly valid directory path. > 2) > unmounted network drives (\\server\path) Yeah, those have a different prefix: \\?\UNC\server\share > I'm not sure how a --unc should handle those cases. > For all things I have in mind, not appending \\?\ is preferred, but someone > might expect a hard error. > > Either way, it is another reason why it makes sense for cygpath to handle > those cases, currently I have to parse it's output before prepending '\\?\'. I'll take a look. > > > Notice that creating a dos path leads to an error. > > > > I don't understand. Creating which DOS path with which application? > > I meant that it is not possible to create a DOS path to C:\test., thus using > a dos path is not a viable workaround to unc: > > ---- > > cd 'C:/test.' > > cygpath -ws . > cygpath: cannot create short name of . > ---- Don't use -s, it's just for the old short name style of DOS paths. Nobody should actually need this nowadays, and sometimes short paths don't even exist. It's a functionality inside the FS driver, afaik, and it can be switched off in the system. In your example, standard filenames work: $ cd /cygdrive/c $ mkdir test. $ cd test. $ cygpath -ws . cygpath: cannot create short name of C:\test. $ cygpath -wa . C:\test. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple