diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index bb27230232..d3acb97343 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -541,8 +541,7 @@ type function GetUnparsedPath(Option: TParsedCompilerOptString; InheritedOption: TInheritedCompilerOption; RelativeToBaseDir: boolean): string; - function ShortenPath(const SearchPath: string; - MakeAlwaysRelative: boolean): string; + function ShortenPath(const SearchPath: string): string; function GetCustomOptions(Parsed: TCompilerOptionsParseType): string; function TrimCustomOptions(o: string): string; override; function GetOptionsForCTDefines: string; @@ -1164,7 +1163,7 @@ procedure TBaseCompilerOptions.SetIncludePaths(const AValue: String); var NewValue: String; begin - NewValue:=ShortenPath(AValue,false); + NewValue:=ShortenPath(AValue); if IncludePath=NewValue then exit; ParsedOpts.SetUnparsedValue(pcosIncludePath,NewValue); {$IFDEF VerboseIDEModified} @@ -1212,7 +1211,7 @@ procedure TBaseCompilerOptions.SetSrcPath(const AValue: string); var NewValue: String; begin - NewValue:=ShortenPath(AValue,false); + NewValue:=ShortenPath(AValue); if SrcPath=NewValue then exit; ParsedOpts.SetUnparsedValue(pcosSrcPath,NewValue); {$IFDEF VerboseIDEModified} @@ -1225,7 +1224,7 @@ procedure TBaseCompilerOptions.SetDebugPath(const AValue: string); var NewValue: String; begin - NewValue:=ShortenPath(AValue,false); + NewValue:=ShortenPath(AValue); if DebugPath=NewValue then exit; ParsedOpts.SetUnparsedValue(pcosDebugPath,NewValue); {$IFDEF VerboseIDEModified} @@ -1404,7 +1403,7 @@ procedure TBaseCompilerOptions.SetLibraryPaths(const AValue: String); var NewValue: String; begin - NewValue:=ShortenPath(AValue,false); + NewValue:=ShortenPath(AValue); if Libraries=NewValue then exit; ParsedOpts.SetUnparsedValue(pcosLibraryPath,NewValue); {$IFDEF VerboseIDEModified} @@ -1438,7 +1437,7 @@ procedure TBaseCompilerOptions.SetUnitPaths(const AValue: String); var NewValue: String; begin - NewValue:=ShortenPath(AValue,false); + NewValue:=ShortenPath(AValue); if OtherUnitFiles=NewValue then exit; ParsedOpts.SetUnparsedValue(pcosUnitPath,NewValue); {$IFDEF VerboseIDEModified} @@ -1461,7 +1460,7 @@ procedure TBaseCompilerOptions.SetObjectPath(const AValue: string); var NewValue: String; begin - NewValue:=ShortenPath(AValue,false); + NewValue:=ShortenPath(AValue); if ObjectPath=NewValue then exit; ParsedOpts.SetUnparsedValue(pcosObjectPath,NewValue); {$IFDEF VerboseIDEModified} @@ -2545,14 +2544,9 @@ begin SetUnitPaths(RemoveSearchPaths(GetUnitPaths,RemSearchPath)); end; -function TBaseCompilerOptions.ShortenPath(const SearchPath: string; - MakeAlwaysRelative: boolean): string; +function TBaseCompilerOptions.ShortenPath(const SearchPath: string): string; begin - Result:=TrimSearchPath(SearchPath,''); - if MakeAlwaysRelative then - Result:=CreateRelativeSearchPath(Result,BaseDirectory) - else - Result:=ShortenSearchPath(Result,BaseDirectory,BaseDirectory); + Result:=ShortenSearchPath(TrimSearchPath(SearchPath,''),BaseDirectory,BaseDirectory); end; {------------------------------------------------------------------------------ diff --git a/ide/frames/compiler_path_options.pas b/ide/frames/compiler_path_options.pas index 2c82e84f5a..ab3e961d10 100644 --- a/ide/frames/compiler_path_options.pas +++ b/ide/frames/compiler_path_options.pas @@ -443,7 +443,7 @@ function TCompilerPathOptionsFrame.PathEditBtnExecuted(Context: String; var NewP var ExpandedPath: string; begin - NewPath := FCompilerOpts.ShortenPath(NewPath, False); + NewPath := FCompilerOpts.ShortenPath(NewPath); ExpandedPath := TrimSearchPath(NewPath, FCompilerOpts.BaseDirectory, true); Result := CheckSearchPath(Context, ExpandedPath, ccomlHints); end; @@ -452,7 +452,6 @@ procedure TCompilerPathOptionsFrame.FileBrowseBtnClick(Sender: TObject); var OpenDialog: TOpenDialog; DefaultFilename: string; - NewFilename: string; begin OpenDialog := TSelectDirectoryDialog.Create(Self); try @@ -470,12 +469,8 @@ begin else OpenDialog.InitialDir := FCompilerOpts.BaseDirectory; if OpenDialog.Execute then - begin - NewFilename := TrimFilename(OpenDialog.Filename); - NewFilename := FCompilerOpts.ShortenPath(NewFilename, False); if Sender = btnUnitOutputDir then UnitOutputDirEdit.Text := OpenDialog.Filename; - end; finally OpenDialog.Free; end;