made CopySecondaryConfigFile platform independent

added GetDefaultLibraryExt

git-svn-id: trunk@8784 -
This commit is contained in:
vincents 2006-02-20 20:08:57 +00:00
parent 87fb7cfa39
commit 7363d797dc
8 changed files with 65 additions and 66 deletions

View File

@ -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;

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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;
---------------------------------------------------------------------------}

View File

@ -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

View File

@ -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';