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

2)
unmounted network drives (\\server\path)

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 '\\?\'.

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

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

Reply via email to