DJDoubleD / QobuzDownloaderX-MOD

Downloads streams directly from Qobuz. Experimental refactoring of QobuzDownloaderX by AiiR
GNU General Public License v3.0
478 stars 16 forks source link

[Feature Request] Support Long Paths (>260 characters) #56

Closed DJDoubleD closed 11 months ago

DJDoubleD commented 11 months ago

🚀 Feature Request

Is your feature request related to a problem? Please describe.

When downloading tracks for which the total path length exceeds the Windows maximum of 260 characters, the following error occurs:

Unknown error during Track Download.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'Z:\qobuz\- Labels\Argon Verlag\Rebecca Yarros\The things we leave unfinished - Eine Familie. Zwei Geschichten. Tausend Gefühle. (Ungekürzte Lesung [up152nh72omda]\MP3\185 - Kapitel 185 - The things we leave unfinished - Eine Familie. Zwei Geschichten. Tausend Gefühle.mp3'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
   at QobuzDownloaderX.Shared.DownloadManager.<DownloadFileAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at QobuzDownloaderX.Shared.DownloadManager.<DownloadTrackAsync>d__28.MoveNext()

Describe the solution you'd like

Support longer paths, if enabled on Windows 10, Version 1607, and Later


Additional context

An example long track which will give problems if downloaded as part of a label in nested folders: Kapitel 185 - The things we leave unfinished - Eine Familie. Zwei Geschichten. Tausend Gefühle

DJDoubleD commented 11 months ago

Solution will still require users to Enable Long Paths in Windows 10 (Version 1607 and Later)

Will need to add this to the release notes and attach the zipped .reg file to the release (GitHub doesn't allow .ref attachments). Alternative Powershell command:

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

EnableLongPaths.zip