question

JosHuybrighs-1920 avatar image
0 Votes"
JosHuybrighs-1920 asked JosHuybrighs-1920 commented

Long path names in win32 process of a Desktop Bridge app

I have a problem accessing long path names in the win32 process of my Desktop Bridge app.
I added every suggestion I could find about this but when I call DirectoryInfo in the win32 process on a folder that has a long pathname, the attributes of the directory are always set to -1.
The directory info is obtained as follows:

 DirectoryInfo dir = new DirectoryInfo(dirPath);

  1. The win32 process is build against .net Framework 4.7.2

  2. The registry has of course the correct setting for long pathnames.

  3. I also tried all the suggestions about the manifest file and adding a WindowsSettings tag and longPathAware tag but with no luck: - It can't be added in the 'packaging' project (different schemas concept). - It can be added in the win32 manifest but same error and I also don't think that a win32 manifest is actually used in a Desktop Bridge app. - And last, I'm not sure whether the manifest entry is still required when building against 4.7.2.

My test involves a local directory within which I created a couple of subfolders to get to something bigger than 260. I copied also some files in those folders. All done using Powershell.

Any idea what to do here?

windows-desktop-bridge
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

When you access long path names only in the win32 program, will the same issue occur? Or is this problem only happening in the win32 process of Desktop Bridge app?

0 Votes 0 ·

It is only happening in the win32 process of the app.

0 Votes 0 ·
JosHuybrighs-1920 avatar image
0 Votes"
JosHuybrighs-1920 answered JosHuybrighs-1920 edited

I managed to get it working by changing all my pathnames to the 'DOS Device Path' format, This is:

     C:\Temp becomes \\?\C:\Temp, and
     \\Mars\Share\Temp becomes \\?\UNC\Mars\Share\Temp

See Path Format Overview

That is not what I would expect to do in 2020 when using .Net Framework 4.7 and higher. It is unclear whether something still has to be set in the manifest file (I don't think it is). And, if it is really necessary, it is even more unclear how to do that in a Desktop Bridge app.
The DOS Device Path format however seems to do the trick.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AntonClark-2426 avatar image
0 Votes"
AntonClark-2426 Suspended answered JosHuybrighs-1920 commented

Long path tool was always there for me in this type of

problem. I've been using it for months now and it is

really helpful

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for the suggestion.

I agree that for some people Long Path Tool would be something you can use but since my app is a Sync/Backup app (SyncFolder) that is distributed through the Windows Store, incorporating a 3rd party tool in the app would not be so easy.

0 Votes 0 ·