[fpc-pascal] ExtractFilePath(GetModuleName(0)) problem

Michael Van Canneyt michael at freepascal.org
Sat Apr 11 12:19:19 CEST 2009



On Sat, 11 Apr 2009, lloyd thomas wrote:

> Need Help please "confini :=
> ExtractFilePath(GetModuleName(0))+'\myfile.ini';" returns C:Program
> FilesMyApp\myfile.ini should be C:\Program Files\MyApp\myfile.ini . Am I
> doing something wrong?
> 
> The Problem is intermitent
> 
>     {$IFDEF Windows}
> confini  := ExtractFilePath(GetModuleName(0))+'\Myfile.ini';

Another thing: Do not add a \ yourself. ExtractFilePath returns
as the last character a \ , so you'll have MyApp\\MyFile.ini 
in the end, and I think windows doesn't like that.

Michael.



More information about the fpc-pascal mailing list