mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 19:08:03 +02:00
made CopySecondaryConfigFile platform independent
added GetDefaultLibraryExt git-svn-id: trunk@8784 -
This commit is contained in:
parent
87fb7cfa39
commit
7363d797dc
@ -1286,10 +1286,6 @@ function TBaseCompilerOptions.CreateTargetFilename(
|
||||
Ext: String;
|
||||
begin
|
||||
if (ExtractFileName(Result)='') or (ExtractFileExt(Result)<>'') then exit;
|
||||
if AnsiCompareText(fTargetOS, 'win32') = 0 then begin
|
||||
Result:=Result+'.exe';
|
||||
exit;
|
||||
end;
|
||||
Ext:=GetDefaultExecutableExt;
|
||||
if Ext<>'' then begin
|
||||
Result:=Result+Ext;
|
||||
|
@ -27,10 +27,16 @@
|
||||
***************************************************************************
|
||||
}
|
||||
|
||||
{Should become unit Unix in the future. For both Linux and FreeBSD}
|
||||
{For Darwin specific implementations.
|
||||
General unix implementations are in ../unix/lazbaseconf.inc}
|
||||
uses
|
||||
BaseUnix, Unix;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.dylib';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:='darwin';
|
||||
|
@ -27,10 +27,16 @@
|
||||
***************************************************************************
|
||||
}
|
||||
|
||||
{Should become unit Unix in the future. For both Linux and FreeBSD}
|
||||
{For FreeBSD specific implementations.
|
||||
General unix implementations are in ../unix/lazbaseconf.inc}
|
||||
uses
|
||||
BaseUnix, Unix;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.so';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:='freebsd';
|
||||
|
@ -26,9 +26,16 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
}
|
||||
{For Linux specific implementations.
|
||||
General unix implementations are in ../unix/lazbaseconf.inc}
|
||||
uses
|
||||
Unix, BaseUnix;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.so';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:='linux';
|
||||
|
@ -27,10 +27,16 @@
|
||||
***************************************************************************
|
||||
}
|
||||
|
||||
{Should become unit Unix in the future. For both Linux and FreeBSD}
|
||||
{For NetBSD specific implementations.
|
||||
General unix implementations are in ../unix/lazbaseconf.inc}
|
||||
uses
|
||||
baseunix, unix;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.so';
|
||||
end;
|
||||
|
||||
function GetDefaultTargetOS: string;
|
||||
begin
|
||||
Result:='netbsd';
|
||||
|
@ -98,35 +98,6 @@ begin
|
||||
SecondaryConfigPath:=ExpandFileName(NewValue);
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
CopySecondaryConfigFile procedure
|
||||
---------------------------------------------------------------------------}
|
||||
procedure CopySecondaryConfigFile(const AFilename: String);
|
||||
var
|
||||
PrimaryFilename, SecondaryFilename: string;
|
||||
SrcFS, DestFS: TFileStream;
|
||||
begin
|
||||
PrimaryFilename:=GetPrimaryConfigPath+PathDelim+AFilename;
|
||||
SecondaryFilename:=GetSecondaryConfigPath+PathDelim+AFilename;
|
||||
if (not FileExists(PrimaryFilename))
|
||||
and (FileExists(SecondaryFilename)) then begin
|
||||
try
|
||||
SrcFS:=TFileStream.Create(SecondaryFilename,fmOpenRead);
|
||||
try
|
||||
DestFS:=TFileStream.Create(PrimaryFilename,fmCreate);
|
||||
try
|
||||
DestFS.CopyFrom(SrcFS,SrcFS.Size);
|
||||
finally
|
||||
DestFS.Free;
|
||||
end;
|
||||
finally
|
||||
SrcFS.Free;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
function CreateCompilerTestPascalFilename: string;
|
||||
---------------------------------------------------------------------------}
|
||||
|
@ -85,35 +85,6 @@ begin
|
||||
SecondaryConfigPath:=NewValue;
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
CopySecondaryConfigFile procedure
|
||||
---------------------------------------------------------------------------}
|
||||
procedure CopySecondaryConfigFile(const AFilename: String);
|
||||
var
|
||||
PrimaryFilename, SecondaryFilename: string;
|
||||
SrcFS, DestFS: TFileStream;
|
||||
begin
|
||||
PrimaryFilename:=GetPrimaryConfigPath+PathDelim+AFilename;
|
||||
SecondaryFilename:=GetSecondaryConfigPath+PathDelim+AFilename;
|
||||
if (not FileExists(PrimaryFilename))
|
||||
and (FileExists(SecondaryFilename)) then begin
|
||||
try
|
||||
SrcFS:=TFileStream.Create(SecondaryFilename,fmOpenRead);
|
||||
try
|
||||
DestFS:=TFileStream.Create(PrimaryFilename,fmCreate);
|
||||
try
|
||||
DestFS.CopyFrom(SrcFS,SrcFS.Size);
|
||||
finally
|
||||
DestFS.Free;
|
||||
end;
|
||||
finally
|
||||
SrcFS.Free;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function FindDefaultCompilerPath: string;
|
||||
begin
|
||||
Result:=SearchFileInPath(GetDefaultCompilerFilename,
|
||||
@ -152,6 +123,11 @@ begin
|
||||
Result:='.exe';
|
||||
end;
|
||||
|
||||
function GetDefaultLibraryExt: string;
|
||||
begin
|
||||
Result:='.dll';
|
||||
end;
|
||||
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
begin
|
||||
if (FPCVersion=1) and (FPCRelease=0) then
|
||||
|
@ -99,7 +99,9 @@ const
|
||||
|
||||
// returns the standard file extension (e.g '.exe')
|
||||
function GetDefaultExecutableExt: string;
|
||||
|
||||
// returns the standard file extension (e.g '.dll' or '.dylib')
|
||||
function GetDefaultLibraryExt: string;
|
||||
|
||||
// returns the standard file extension for compiled units (e.g '.ppu')
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
|
||||
@ -156,6 +158,35 @@ begin
|
||||
List.Free;
|
||||
end;
|
||||
|
||||
{---------------------------------------------------------------------------
|
||||
CopySecondaryConfigFile procedure
|
||||
---------------------------------------------------------------------------}
|
||||
procedure CopySecondaryConfigFile(const AFilename: String);
|
||||
var
|
||||
PrimaryFilename, SecondaryFilename: string;
|
||||
SrcFS, DestFS: TFileStream;
|
||||
begin
|
||||
PrimaryFilename:=GetPrimaryConfigPath+PathDelim+AFilename;
|
||||
SecondaryFilename:=GetSecondaryConfigPath+PathDelim+AFilename;
|
||||
if (not FileExists(PrimaryFilename))
|
||||
and (FileExists(SecondaryFilename)) then begin
|
||||
try
|
||||
SrcFS:=TFileStream.Create(SecondaryFilename,fmOpenRead);
|
||||
try
|
||||
DestFS:=TFileStream.Create(PrimaryFilename,fmCreate);
|
||||
try
|
||||
DestFS.CopyFrom(SrcFS,SrcFS.Size);
|
||||
finally
|
||||
DestFS.Free;
|
||||
end;
|
||||
finally
|
||||
SrcFS.Free;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetProjectSessionsConfigPath: String;
|
||||
begin
|
||||
Result:=AppendPathDelim(GetPrimaryConfigPath)+'projectsessions';
|
||||
|
Loading…
Reference in New Issue
Block a user