mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 13:39:11 +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;
|
Ext: String;
|
||||||
begin
|
begin
|
||||||
if (ExtractFileName(Result)='') or (ExtractFileExt(Result)<>'') then exit;
|
if (ExtractFileName(Result)='') or (ExtractFileExt(Result)<>'') then exit;
|
||||||
if AnsiCompareText(fTargetOS, 'win32') = 0 then begin
|
|
||||||
Result:=Result+'.exe';
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
Ext:=GetDefaultExecutableExt;
|
Ext:=GetDefaultExecutableExt;
|
||||||
if Ext<>'' then begin
|
if Ext<>'' then begin
|
||||||
Result:=Result+Ext;
|
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
|
uses
|
||||||
BaseUnix, Unix;
|
BaseUnix, Unix;
|
||||||
|
|
||||||
|
function GetDefaultLibraryExt: string;
|
||||||
|
begin
|
||||||
|
Result:='.dylib';
|
||||||
|
end;
|
||||||
|
|
||||||
function GetDefaultTargetOS: string;
|
function GetDefaultTargetOS: string;
|
||||||
begin
|
begin
|
||||||
Result:='darwin';
|
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
|
uses
|
||||||
BaseUnix, Unix;
|
BaseUnix, Unix;
|
||||||
|
|
||||||
|
function GetDefaultLibraryExt: string;
|
||||||
|
begin
|
||||||
|
Result:='.so';
|
||||||
|
end;
|
||||||
|
|
||||||
function GetDefaultTargetOS: string;
|
function GetDefaultTargetOS: string;
|
||||||
begin
|
begin
|
||||||
Result:='freebsd';
|
Result:='freebsd';
|
||||||
|
@ -26,9 +26,16 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
}
|
}
|
||||||
|
{For Linux specific implementations.
|
||||||
|
General unix implementations are in ../unix/lazbaseconf.inc}
|
||||||
uses
|
uses
|
||||||
Unix, BaseUnix;
|
Unix, BaseUnix;
|
||||||
|
|
||||||
|
function GetDefaultLibraryExt: string;
|
||||||
|
begin
|
||||||
|
Result:='.so';
|
||||||
|
end;
|
||||||
|
|
||||||
function GetDefaultTargetOS: string;
|
function GetDefaultTargetOS: string;
|
||||||
begin
|
begin
|
||||||
Result:='linux';
|
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
|
uses
|
||||||
baseunix, unix;
|
baseunix, unix;
|
||||||
|
|
||||||
|
function GetDefaultLibraryExt: string;
|
||||||
|
begin
|
||||||
|
Result:='.so';
|
||||||
|
end;
|
||||||
|
|
||||||
function GetDefaultTargetOS: string;
|
function GetDefaultTargetOS: string;
|
||||||
begin
|
begin
|
||||||
Result:='netbsd';
|
Result:='netbsd';
|
||||||
|
@ -98,35 +98,6 @@ begin
|
|||||||
SecondaryConfigPath:=ExpandFileName(NewValue);
|
SecondaryConfigPath:=ExpandFileName(NewValue);
|
||||||
end;
|
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;
|
function CreateCompilerTestPascalFilename: string;
|
||||||
---------------------------------------------------------------------------}
|
---------------------------------------------------------------------------}
|
||||||
|
@ -85,35 +85,6 @@ begin
|
|||||||
SecondaryConfigPath:=NewValue;
|
SecondaryConfigPath:=NewValue;
|
||||||
end;
|
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;
|
function FindDefaultCompilerPath: string;
|
||||||
begin
|
begin
|
||||||
Result:=SearchFileInPath(GetDefaultCompilerFilename,
|
Result:=SearchFileInPath(GetDefaultCompilerFilename,
|
||||||
@ -152,6 +123,11 @@ begin
|
|||||||
Result:='.exe';
|
Result:='.exe';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetDefaultLibraryExt: string;
|
||||||
|
begin
|
||||||
|
Result:='.dll';
|
||||||
|
end;
|
||||||
|
|
||||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||||
begin
|
begin
|
||||||
if (FPCVersion=1) and (FPCRelease=0) then
|
if (FPCVersion=1) and (FPCRelease=0) then
|
||||||
|
@ -99,6 +99,8 @@ const
|
|||||||
|
|
||||||
// returns the standard file extension (e.g '.exe')
|
// returns the standard file extension (e.g '.exe')
|
||||||
function GetDefaultExecutableExt: string;
|
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')
|
// returns the standard file extension for compiled units (e.g '.ppu')
|
||||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||||
@ -156,6 +158,35 @@ begin
|
|||||||
List.Free;
|
List.Free;
|
||||||
end;
|
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;
|
function GetProjectSessionsConfigPath: String;
|
||||||
begin
|
begin
|
||||||
Result:=AppendPathDelim(GetPrimaryConfigPath)+'projectsessions';
|
Result:=AppendPathDelim(GetPrimaryConfigPath)+'projectsessions';
|
||||||
|
Loading…
Reference in New Issue
Block a user