mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-05 15:20:38 +02:00
IDE: changed CreateCompilerTestPascalFilename as suggested by Mattias
* return '', if no file could be created * use same implementation on all platforms git-svn-id: trunk@15790 -
This commit is contained in:
parent
5b3c40da89
commit
92b6e4d35d
@ -99,33 +99,6 @@ begin
|
||||
SecondaryConfigPath:=ExpandFileName(NewValue);
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
function CreateCompilerTestPascalFilename: string;
|
||||
---------------------------------------------------------------------------}
|
||||
function CreateCompilerTestPascalFilename: string;
|
||||
|
||||
function CreateFile(const Filename: string): boolean;
|
||||
var
|
||||
fs: TFileStream;
|
||||
begin
|
||||
if FileExists(Filename) then exit(true);
|
||||
Result:=false;
|
||||
try
|
||||
fs:=TFileStream.Create(Filename,fmCreate);
|
||||
fs.Free;
|
||||
Result:=true;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=AppendPathDelim(GetPrimaryConfigPath)+'compilertest.pas';
|
||||
if CreateFile(Result) then exit;
|
||||
Result:=AppendPathDelim(GetTempDir)+'compilertest1.pas';
|
||||
if CreateFile(Result) then exit;
|
||||
writeln('unable to create temporay file ',Result);
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
function FindDefaultCompilerPath: string;
|
||||
---------------------------------------------------------------------------}
|
||||
|
@ -107,18 +107,6 @@ begin
|
||||
[]);
|
||||
end;
|
||||
|
||||
function CreateCompilerTestPascalFilename: string;
|
||||
var
|
||||
fs: TFileStream;
|
||||
begin
|
||||
Result := AppendPathDelim(GetPrimaryConfigPath) + 'compilertest.pas';
|
||||
if not FileExists(Result) then
|
||||
begin
|
||||
fs := TFileStream.Create(Result, fmCreate);
|
||||
fs.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
begin
|
||||
if (FPCVersion=1) and (FPCRelease=0) then
|
||||
|
@ -130,6 +130,34 @@ implementation
|
||||
|
||||
{$I lazconf.inc}
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
function CreateCompilerTestPascalFilename: string;
|
||||
---------------------------------------------------------------------------}
|
||||
function CreateCompilerTestPascalFilename: string;
|
||||
|
||||
function CreateFile(const Filename: string): boolean;
|
||||
var
|
||||
fs: TFileStream;
|
||||
begin
|
||||
if FileExists(Filename) then exit(true);
|
||||
Result:=false;
|
||||
try
|
||||
fs:=TFileStream.Create(Filename,fmCreate);
|
||||
fs.Free;
|
||||
Result:=true;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Result:=AppendPathDelim(GetPrimaryConfigPath)+'compilertest.pas';
|
||||
if CreateFile(Result) then exit;
|
||||
Result:=AppendPathDelim(GetTempDir)+'compilertest.pas';
|
||||
if CreateFile(Result) then exit;
|
||||
Debugln('unable to create temporay file ',Result);
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
function FindDefaultExecutablePath(const Executable: string): string;
|
||||
begin
|
||||
if FilenameIsAbsolute(Executable) then
|
||||
|
Loading…
Reference in New Issue
Block a user