[Lazarus] With new Win32 manifest LongPathAware I cannot make long filename

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] With new Win32 manifest LongPathAware I cannot make long filename

Free Pascal - Lazarus mailing list
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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] With new Win32 manifest LongPathAware I cannot make long filename

Free Pascal - Lazarus mailing list

On Fri, 23 Nov 2018, AlexeyT via lazarus wrote:

> 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.

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] With new Win32 manifest LongPathAware I cannot make long filename

Free Pascal - Lazarus mailing list
 I turned new Ide manifest option (subj) on, so I can skip prefix, no?
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] With new Win32 manifest LongPathAware I cannot make long filename

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Am 23.11.2018 um 15:24 schrieb AlexeyT via lazarus:
> This app cannot make 2nd folder (it can make 1st) and make file. Error
> on file saving. why? new manifest option is used. Win10.

Does the same code work if you use the LongPathsEnabled registry setting?

If so, there may be something off with the manifest...

--
Regards,
Martok

Ceterum censeo b32079 esse sanandam.

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] With new Win32 manifest LongPathAware I cannot make long filename

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list

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


On 23/11/2018 14:24, AlexeyT via lazarus wrote:

> 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;
>

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus