Thread overview
[Issue 17329] File.remove() has problems with long filenames (>128 bytes)
Apr 17, 2017
b2.temp@gmx.com
Apr 18, 2017
Rainer Koschnick
Apr 20, 2017
b2.temp@gmx.com
Apr 20, 2017
Rainer Koschnick
Mar 21, 2020
Basile-z
Dec 17, 2022
Iain Buclaw
April 17, 2017
https://issues.dlang.org/show_bug.cgi?id=17329

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from b2.temp@gmx.com ---
(In reply to Rainer Koschnick from comment #0)
> This is a rather weird issue that only pops up in a release build:
> 
> std.file.FileException@D:\Dlang\dmd2\windows\bin\..\..\src\phobos\std\file. d(733): 12345678901234567890123456789012345678901234567890123456789012345678901234567 89012345678901234567890123456789012345678901234.cbr: The system cannot find the file specified.
> 
> Filenames up to 128 bytes work fine, anything above it throws this exception.
> 
> Building in Visual Studio 2017, output is MS-COFF. The debug build works fine.

Try

void removeFileEx(string filename)
{
    import std.file : remove;
    return remove("\\?\" ~ filename);
}

Adding the prefix turns the filename into a fully qualified name and should have for effect to remove the MAX_PATH (260 chars) limitation.

--
April 18, 2017
https://issues.dlang.org/show_bug.cgi?id=17329

--- Comment #2 from Rainer Koschnick <arkay@gmx.net> ---
Thanks for the hint, but it doesn't change anything.

Error:
\\?\0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.cbz:
The system cannot find the file specified.

Neither does...

Error:
.\0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.cbz:
The system cannot find the file specified.

Nor using a complete path...

Error:
D:\_Development_\D\cbc\0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.cbz:
The system cannot find the file specified.

--
April 20, 2017
https://issues.dlang.org/show_bug.cgi?id=17329

--- Comment #3 from b2.temp@gmx.com ---
I meant fully qualified filename !

\\?\D:\_Development_\D\cbc\...

--
April 20, 2017
https://issues.dlang.org/show_bug.cgi?id=17329

--- Comment #4 from Rainer Koschnick <arkay@gmx.net> ---
I tried it with the path as you can see up there!

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=17329

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=17329

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--