mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 04:09:11 +02:00
* check environment variable LOCALAPPDATA on windows as a possible cache location for instantfpc
git-svn-id: trunk@19497 -
This commit is contained in:
parent
f005d71110
commit
ace6bfd4e9
@ -38,7 +38,7 @@ function IsCacheValid(Src: TStringList;
|
|||||||
procedure Compile(const SrcFilename, CacheFilename, OutputFilename: string);
|
procedure Compile(const SrcFilename, CacheFilename, OutputFilename: string);
|
||||||
procedure WriteCompilerOutput(SrcFilename, CacheFilename, CompilerOutput: string);
|
procedure WriteCompilerOutput(SrcFilename, CacheFilename, CompilerOutput: string);
|
||||||
function GetCompiler: string;
|
function GetCompiler: string;
|
||||||
procedure SetCompiler(AValue : string);
|
procedure SetCompiler(AValue : string);
|
||||||
function GetCompilerParameters(const SrcFilename, OutputFilename: string): string;
|
function GetCompilerParameters(const SrcFilename, OutputFilename: string): string;
|
||||||
procedure Run(const Filename: string);
|
procedure Run(const Filename: string);
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ implementation
|
|||||||
Var
|
Var
|
||||||
CmdCacheDir : String;
|
CmdCacheDir : String;
|
||||||
CmdCompiler : String;
|
CmdCompiler : String;
|
||||||
|
|
||||||
procedure AddParam(p: string; var Line: string);
|
procedure AddParam(p: string; var Line: string);
|
||||||
begin
|
begin
|
||||||
if p='' then exit;
|
if p='' then exit;
|
||||||
@ -96,18 +96,22 @@ end;
|
|||||||
function GetCacheDir: string;
|
function GetCacheDir: string;
|
||||||
begin
|
begin
|
||||||
Result:=CmdCacheDir;
|
Result:=CmdCacheDir;
|
||||||
if (Result='') then
|
if (Result='') then
|
||||||
begin
|
begin
|
||||||
Result:=GetEnvironmentVariable('INSTANTFPCCACHE');
|
Result:=GetEnvironmentVariable('INSTANTFPCCACHE');
|
||||||
if Result='' then
|
if Result='' then
|
||||||
begin
|
begin
|
||||||
Result:=GetEnvironmentVariable('HOME');
|
Result:=GetEnvironmentVariable('HOME');
|
||||||
|
{$ifdef WINDOWS}
|
||||||
|
if Result='' then
|
||||||
|
Result:=GetEnvironmentVariable('LOCALAPPDATA');
|
||||||
|
{$endif WINDOWS}
|
||||||
if Result<>'' then
|
if Result<>'' then
|
||||||
Result:=IncludeTrailingPathDelimiter(Result)+'.cache'+PathDelim+'instantfpc';
|
Result:=IncludeTrailingPathDelimiter(Result)+'.cache'+PathDelim+'instantfpc';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if Result='' then begin
|
if Result='' then begin
|
||||||
writeln('missing environment variable: HOME or INSTANTFPCCACHE');
|
writeln('missing environment variable: HOME or INSTANTFPCCACHE or LOCALAPPDATA');
|
||||||
Halt(1);
|
Halt(1);
|
||||||
end;
|
end;
|
||||||
Result:=IncludeTrailingPathDelimiter(ExpandFileName(Result));
|
Result:=IncludeTrailingPathDelimiter(ExpandFileName(Result));
|
||||||
@ -140,7 +144,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure SetCompiler(AValue : string);
|
procedure SetCompiler(AValue : string);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
CmdCompiler:=AValue;
|
CmdCompiler:=AValue;
|
||||||
@ -195,7 +199,7 @@ begin
|
|||||||
if (Result<>'') then
|
if (Result<>'') then
|
||||||
begin
|
begin
|
||||||
Result:=ExpandFileName(Result);
|
Result:=ExpandFileName(Result);
|
||||||
if not FileExists(Result) then
|
if not FileExists(Result) then
|
||||||
begin
|
begin
|
||||||
writeln('Error: '+Result+' not found, check the --compiler parameter.');
|
writeln('Error: '+Result+' not found, check the --compiler parameter.');
|
||||||
Halt(1);
|
Halt(1);
|
||||||
@ -285,7 +289,7 @@ begin
|
|||||||
p:=ParamStr(i);
|
p:=ParamStr(i);
|
||||||
if (Copy(p,1,1)='-') and (copy(p,1,2)<>'--') then
|
if (Copy(p,1,1)='-') and (copy(p,1,2)<>'--') then
|
||||||
AddParam(P,Result);
|
AddParam(P,Result);
|
||||||
inc(I);
|
inc(I);
|
||||||
end;
|
end;
|
||||||
AddParam('-o'+OutputFilename {$IFDEF HASEXEEXT} + '.exe' {$ENDIF},Result);
|
AddParam('-o'+OutputFilename {$IFDEF HASEXEEXT} + '.exe' {$ENDIF},Result);
|
||||||
AddParam(SrcFilename,Result);
|
AddParam(SrcFilename,Result);
|
||||||
|
Loading…
Reference in New Issue
Block a user