heribertolugo / FileList

List all files in a given directory, and provide the option to copy or move selected files.
1 stars 0 forks source link

Path Too Long Exception #92

Open heribertolugo opened 2 years ago

heribertolugo commented 2 years ago

when there is a tilde in the path, System.IO.Path.GetDirectoryName assumes the path is too long and will throw a System.IO.PathTooLongException , even if the file path is within max length.

Project: Common File: FileData.cs Method: public string Directory Code: _this.diectory = System.IO.Path.GetDirectoryName(this.Path) + "\"; Example: _E:\tri_boot_backup\Desktop\Data Recovery 2016-03-08 at 21.58.05\Data Recovery 2016-03-21 at 02.43.07\G\Program Files\Windows Sidebar\Gadgets\SlideShow.Gadget\images\insidebar-QUEBU~1.MP4

heribertolugo commented 2 years ago

it turns out path name is actually too long. correct file name is: - Que Buena Tu Ta Remix-Fuego, Black Point, Mozart, Sensato, Monkey Black, Los Pepes & Villanosam.mp4

a workaround needs to be found.

heribertolugo commented 2 years ago

a workaround will be used in which - if System.IO fails to process path, it will be processed manually using string functions. This solution assumes built in System.IO path processing is faster than manual (not tested because, i mean, whos got time for that).

a possible better solution that should be investigated would be using win32 api to process the path; and create a wrapper for use in c#.

heribertolugo commented 2 years ago

this exception is also getting thrown when using System.IO.GetDirectories and System.IO.GetFiles.

a workaround needs to be implemented.