Arlodotexe / OwlCore.Storage

The most flexible file system abstraction, ever. Built in partnership with the UWP Community.
16 stars 4 forks source link

Long Path Support #32

Closed HEIC-to-JPEG-Dev closed 1 year ago

HEIC-to-JPEG-Dev commented 1 year ago

Issue Owlcore.Storage does not support long paths [>260 characters]

Reason The managed code in .net is being used in it's basic form; under the covers, the wide Win32 API is being used, however, the correct parameters for long paths is not being set.

Proposal Implement internal (the the class) long path support. Retain external (public properties of the class) use of simple strings.

Arlodotexe commented 1 year ago

@HEIC-to-JPEG-Dev I thought LongPath support gets enabled at the OS level 🤔

Can you tell me more about what this might look like? What class is this for?

HEIC-to-JPEG-Dev commented 1 year ago

.Net supports long filenames but doesn't implement it by default, neither do the underlying Win32 API's (even file explorer doesn't do it)

Prefix paths with \?\ when passing the path to any methods.

Windows 10 supports long paths but's in an opt-in via the registry, an no user will do that.

Arlodotexe commented 1 year ago

Prefix paths with \?\ when passing the path to any methods.

Ideally, long-length paths should be done by the running OS and .NET runtime. Until that's the case, simply prefix the path you give to the constructors of SystemFile and SystemFolder if you need it for your application. We pass this to System.IO directly, without modifications.