IDE: comments

git-svn-id: trunk@42748 -
This commit is contained in:
mattias 2013-09-12 00:52:25 +00:00
parent 3862ac7b3f
commit 9ed5b3d606

View File

@ -1225,11 +1225,13 @@ procedure TMainIDE.LoadGlobalOptions;
end; end;
var var
EnvOptsCfgExisted: boolean; EnvOptsCfgExisted: boolean;
s, s1, s2, LastCalled: String; s, LastCalled: String;
OldVer: String; OldVer: String;
NowVer: String; NowVer: String;
IsUpgrade: boolean; IsUpgrade: boolean;
MsgResult: TModalResult; MsgResult: TModalResult;
CurPrgName: String;
AltPrgName: String;
begin begin
with EnvironmentOptions do with EnvironmentOptions do
begin begin
@ -1241,36 +1243,42 @@ begin
Load(false); Load(false);
end; end;
s2 := ExtractFileName(ParamStrUTF8(0)); s := ExtractFileName(ParamStrUTF8(0));
s := AppendPathDelim(ProgramDirectory(False)) + s2; CurPrgName := TrimFilename(AppendPathDelim(ProgramDirectory(False)) + s);
s1 := s; // keep case correct copy AltPrgName := TrimFilename(AppendPathDelim(AppendPathDelim(GetPrimaryConfigPath) + 'bin') + s);
s2 := AppendPathDelim(AppendPathDelim(GetPrimaryConfigPath) + 'bin') + s2;
LastCalled := EnvironmentOptions.LastCalledByLazarusFullPath; LastCalled := EnvironmentOptions.LastCalledByLazarusFullPath;
{$IFDEF Windows} if (LastCalled = '') then
s := LowerCase(s); begin
s2 := LowerCase(s2); // this PCP was not yet used (at least not with a version with LastCalledByLazarusFullPath)
LastCalled := LowerCase(LastCalled); if CompareFilenames(CurPrgName,AltPrgName)=0 then
{$ENDIF} begin
if (LastCalled = '') then begin // a custom built IDE is started and the PCP has no information about the
if (s <> s2) then begin // do not set to exe in pcp // original lazarus exe
EnvironmentOptions.LastCalledByLazarusFullPath := s1; // => Probably someone updated trunk
end else begin
// the lazarus exe was started => remember this exe in the PCP
EnvironmentOptions.LastCalledByLazarusFullPath := CurPrgName;
SaveEnvironment(False); SaveEnvironment(False);
end; end;
end end
else else
if (LastCalled <> s) and if (CompareFilenames(LastCalled,CurPrgName)<>0) and
(LastCalled <> s2) and (CompareFilenames(LastCalled,AltPrgName)<>0) and
(s <> s2) // we can NOT check, if we only have the path inside the PCP (CompareFilenames(CurPrgName,AltPrgName)<>0) // we can NOT check, if we only have the path inside the PCP
then begin then begin
// last time the PCP was started from another lazarus exe
// => either the user forgot to pass a --pcp
// or the user uninstalled and installed to another directory
// => warn
MsgResult := IDEQuestionDialog(lisIncorrectConfigurationDirectoryFound, MsgResult := IDEQuestionDialog(lisIncorrectConfigurationDirectoryFound,
Format(lisIDEConficurationFoundMayBelongToOtherLazarus, Format(lisIDEConficurationFoundMayBelongToOtherLazarus,
[LineEnding, GetSecondConfDirWarning, GetPrimaryConfigPath, [LineEnding, GetSecondConfDirWarning, GetPrimaryConfigPath,
EnvironmentOptions.LastCalledByLazarusFullPath, s1]), EnvironmentOptions.LastCalledByLazarusFullPath, CurPrgName]),
mtWarning, [mrOK, lisUpdateInfo, mrIgnore, mrAbort]); mtWarning, [mrOK, lisUpdateInfo, mrIgnore, mrAbort]);
case MsgResult of case MsgResult of
mrOk: begin mrOk: begin
EnvironmentOptions.LastCalledByLazarusFullPath := s; EnvironmentOptions.LastCalledByLazarusFullPath := CurPrgName;
SaveEnvironment(False); SaveEnvironment(False);
end; end;
mrIgnore: ; mrIgnore: ;