[fpc-pascal] EFCreateError' Unable to create file

Bart bartjunk64 at gmail.com
Sun Jan 25 12:36:56 CET 2009


>  >            Try
>  >            Memo1.Lines.SaveToFile(ExecuteName);
>  >            Except ShowMessage('Shoots, couldnt SaveToFile!');
>  >            end;
>  >
>  > [Project raised exception class 'EFCreateError' with message:
>  > Unable to create file
>  > ""C:lazarusfpc2.2.2bini386-win32Del2PasDel2PasDel2Pas.bat""]
>

You cannot create filenames that have double quotes (") in them on
Windows (your ExecuteName has double quotes in it as you stated
yourself), so the EFCreateError is correct.

See for yourself:

...
  Try
    Memo1.SaveToFile(ExecuteName);
  Except
    On E: Exception do
    begin
      ShowMessage('Exception occurred of '+E.ClassName+LineEnding+
        'Attempted to save to:'+LineEnding+>'+ExecuteName+'<');
    end;

And you will see:

Exception occurred of EFCreateError
Attempted to save to:
>"C:\lazarus\fpc\2.2.2\bin\i386-win32\Del2Pas\Del2Pas\Del2Pas.bat"<

And you will see the double quotes in the filename...


I tested your code in Lazarus and in Delphi and both raise the error
with the filename you supplied to SaveTofile (that is with all
backslashes intact), so I cannot reproduce the second part of your
"bug".

Bart



More information about the fpc-pascal mailing list