Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-11

With new Win32 manifest LongPathAware I cannot make long filename

5 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

AlexeyT

This app cannot make 2nd folder (it can make 1st) and make file. Error on file saving. why? new manifest option is used. Win10.

{ TForm1 }

const
s1='w123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012';
   base='c:\work\';
procedure TForm1.Button1Click(Sender: TObject);
var f: TStringList;
begin
   ForceDirectories(base+s1+'\'+s1);
   f:= tstringlist.create;
   f.add('zzz');
   f.SaveToFile(base+s1+'\'+s1+'\test.txt');
   f.free;
end;
Regards, Alexey

Reply by email

Michael Van Canneyt
to AlexeyT
AlexeyT wrote 13 lines
This app cannot make 2nd folder (it can make 1st) and make file. Error on file saving. why? new manifest option is used. Win10. { TForm1 } const s1='w123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012';   base='c:\work\'; procedure TForm1.Button1Click(Sender: TObject); var f: TStringList; begin   ForceDirectories(base+s1+'\'+s1);

ForceDirectories is in the FPC RTL.
It probably would need to obey the \\?\ prefix if long paths are to be supported.

Michael.

Reply by email

Denis Kozlov
to AlexeyT: This app cannot make 2nd folder (it can make 1st) and make file. Error on file saving.…

The new "Long path awareness" option is working!

Apparently, you need to do both, embed the manifest and enable long paths in the registry or group policy. Only then you will be able to use long paths without the "\\?\" prefix.

To enable via the Local Group Policy Editor, navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem> Enable Win32 long paths = Enabled.

Tested on Windows 10, Lazarus 2.1.0 r59644, using RenameFile RTL routine.

Regards,
Denis

AlexeyT wrote 20 lines
This app cannot make 2nd folder (it can make 1st) and make file. Error on file saving. why? new manifest option is used. Win10. { TForm1 } const s1='w123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012';   base='c:\work\'; procedure TForm1.Button1Click(Sender: TObject); var f: TStringList; begin   ForceDirectories(base+s1+'\'+s1);   f:= tstringlist.create;   f.add('zzz');   f.SaveToFile(base+s1+'\'+s1+'\test.txt');   f.free; end;

Reply by email