mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-12 09:39:16 +02:00
IDE: Simplify function CompilerOptions.ShortenPath.
git-svn-id: trunk@59759 -
This commit is contained in:
parent
971d302ea7
commit
a34569f1b2
@ -541,8 +541,7 @@ type
|
|||||||
function GetUnparsedPath(Option: TParsedCompilerOptString;
|
function GetUnparsedPath(Option: TParsedCompilerOptString;
|
||||||
InheritedOption: TInheritedCompilerOption;
|
InheritedOption: TInheritedCompilerOption;
|
||||||
RelativeToBaseDir: boolean): string;
|
RelativeToBaseDir: boolean): string;
|
||||||
function ShortenPath(const SearchPath: string;
|
function ShortenPath(const SearchPath: string): string;
|
||||||
MakeAlwaysRelative: boolean): string;
|
|
||||||
function GetCustomOptions(Parsed: TCompilerOptionsParseType): string;
|
function GetCustomOptions(Parsed: TCompilerOptionsParseType): string;
|
||||||
function TrimCustomOptions(o: string): string; override;
|
function TrimCustomOptions(o: string): string; override;
|
||||||
function GetOptionsForCTDefines: string;
|
function GetOptionsForCTDefines: string;
|
||||||
@ -1164,7 +1163,7 @@ procedure TBaseCompilerOptions.SetIncludePaths(const AValue: String);
|
|||||||
var
|
var
|
||||||
NewValue: String;
|
NewValue: String;
|
||||||
begin
|
begin
|
||||||
NewValue:=ShortenPath(AValue,false);
|
NewValue:=ShortenPath(AValue);
|
||||||
if IncludePath=NewValue then exit;
|
if IncludePath=NewValue then exit;
|
||||||
ParsedOpts.SetUnparsedValue(pcosIncludePath,NewValue);
|
ParsedOpts.SetUnparsedValue(pcosIncludePath,NewValue);
|
||||||
{$IFDEF VerboseIDEModified}
|
{$IFDEF VerboseIDEModified}
|
||||||
@ -1212,7 +1211,7 @@ procedure TBaseCompilerOptions.SetSrcPath(const AValue: string);
|
|||||||
var
|
var
|
||||||
NewValue: String;
|
NewValue: String;
|
||||||
begin
|
begin
|
||||||
NewValue:=ShortenPath(AValue,false);
|
NewValue:=ShortenPath(AValue);
|
||||||
if SrcPath=NewValue then exit;
|
if SrcPath=NewValue then exit;
|
||||||
ParsedOpts.SetUnparsedValue(pcosSrcPath,NewValue);
|
ParsedOpts.SetUnparsedValue(pcosSrcPath,NewValue);
|
||||||
{$IFDEF VerboseIDEModified}
|
{$IFDEF VerboseIDEModified}
|
||||||
@ -1225,7 +1224,7 @@ procedure TBaseCompilerOptions.SetDebugPath(const AValue: string);
|
|||||||
var
|
var
|
||||||
NewValue: String;
|
NewValue: String;
|
||||||
begin
|
begin
|
||||||
NewValue:=ShortenPath(AValue,false);
|
NewValue:=ShortenPath(AValue);
|
||||||
if DebugPath=NewValue then exit;
|
if DebugPath=NewValue then exit;
|
||||||
ParsedOpts.SetUnparsedValue(pcosDebugPath,NewValue);
|
ParsedOpts.SetUnparsedValue(pcosDebugPath,NewValue);
|
||||||
{$IFDEF VerboseIDEModified}
|
{$IFDEF VerboseIDEModified}
|
||||||
@ -1404,7 +1403,7 @@ procedure TBaseCompilerOptions.SetLibraryPaths(const AValue: String);
|
|||||||
var
|
var
|
||||||
NewValue: String;
|
NewValue: String;
|
||||||
begin
|
begin
|
||||||
NewValue:=ShortenPath(AValue,false);
|
NewValue:=ShortenPath(AValue);
|
||||||
if Libraries=NewValue then exit;
|
if Libraries=NewValue then exit;
|
||||||
ParsedOpts.SetUnparsedValue(pcosLibraryPath,NewValue);
|
ParsedOpts.SetUnparsedValue(pcosLibraryPath,NewValue);
|
||||||
{$IFDEF VerboseIDEModified}
|
{$IFDEF VerboseIDEModified}
|
||||||
@ -1438,7 +1437,7 @@ procedure TBaseCompilerOptions.SetUnitPaths(const AValue: String);
|
|||||||
var
|
var
|
||||||
NewValue: String;
|
NewValue: String;
|
||||||
begin
|
begin
|
||||||
NewValue:=ShortenPath(AValue,false);
|
NewValue:=ShortenPath(AValue);
|
||||||
if OtherUnitFiles=NewValue then exit;
|
if OtherUnitFiles=NewValue then exit;
|
||||||
ParsedOpts.SetUnparsedValue(pcosUnitPath,NewValue);
|
ParsedOpts.SetUnparsedValue(pcosUnitPath,NewValue);
|
||||||
{$IFDEF VerboseIDEModified}
|
{$IFDEF VerboseIDEModified}
|
||||||
@ -1461,7 +1460,7 @@ procedure TBaseCompilerOptions.SetObjectPath(const AValue: string);
|
|||||||
var
|
var
|
||||||
NewValue: String;
|
NewValue: String;
|
||||||
begin
|
begin
|
||||||
NewValue:=ShortenPath(AValue,false);
|
NewValue:=ShortenPath(AValue);
|
||||||
if ObjectPath=NewValue then exit;
|
if ObjectPath=NewValue then exit;
|
||||||
ParsedOpts.SetUnparsedValue(pcosObjectPath,NewValue);
|
ParsedOpts.SetUnparsedValue(pcosObjectPath,NewValue);
|
||||||
{$IFDEF VerboseIDEModified}
|
{$IFDEF VerboseIDEModified}
|
||||||
@ -2545,14 +2544,9 @@ begin
|
|||||||
SetUnitPaths(RemoveSearchPaths(GetUnitPaths,RemSearchPath));
|
SetUnitPaths(RemoveSearchPaths(GetUnitPaths,RemSearchPath));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBaseCompilerOptions.ShortenPath(const SearchPath: string;
|
function TBaseCompilerOptions.ShortenPath(const SearchPath: string): string;
|
||||||
MakeAlwaysRelative: boolean): string;
|
|
||||||
begin
|
begin
|
||||||
Result:=TrimSearchPath(SearchPath,'');
|
Result:=ShortenSearchPath(TrimSearchPath(SearchPath,''),BaseDirectory,BaseDirectory);
|
||||||
if MakeAlwaysRelative then
|
|
||||||
Result:=CreateRelativeSearchPath(Result,BaseDirectory)
|
|
||||||
else
|
|
||||||
Result:=ShortenSearchPath(Result,BaseDirectory,BaseDirectory);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -443,7 +443,7 @@ function TCompilerPathOptionsFrame.PathEditBtnExecuted(Context: String; var NewP
|
|||||||
var
|
var
|
||||||
ExpandedPath: string;
|
ExpandedPath: string;
|
||||||
begin
|
begin
|
||||||
NewPath := FCompilerOpts.ShortenPath(NewPath, False);
|
NewPath := FCompilerOpts.ShortenPath(NewPath);
|
||||||
ExpandedPath := TrimSearchPath(NewPath, FCompilerOpts.BaseDirectory, true);
|
ExpandedPath := TrimSearchPath(NewPath, FCompilerOpts.BaseDirectory, true);
|
||||||
Result := CheckSearchPath(Context, ExpandedPath, ccomlHints);
|
Result := CheckSearchPath(Context, ExpandedPath, ccomlHints);
|
||||||
end;
|
end;
|
||||||
@ -452,7 +452,6 @@ procedure TCompilerPathOptionsFrame.FileBrowseBtnClick(Sender: TObject);
|
|||||||
var
|
var
|
||||||
OpenDialog: TOpenDialog;
|
OpenDialog: TOpenDialog;
|
||||||
DefaultFilename: string;
|
DefaultFilename: string;
|
||||||
NewFilename: string;
|
|
||||||
begin
|
begin
|
||||||
OpenDialog := TSelectDirectoryDialog.Create(Self);
|
OpenDialog := TSelectDirectoryDialog.Create(Self);
|
||||||
try
|
try
|
||||||
@ -470,12 +469,8 @@ begin
|
|||||||
else
|
else
|
||||||
OpenDialog.InitialDir := FCompilerOpts.BaseDirectory;
|
OpenDialog.InitialDir := FCompilerOpts.BaseDirectory;
|
||||||
if OpenDialog.Execute then
|
if OpenDialog.Execute then
|
||||||
begin
|
|
||||||
NewFilename := TrimFilename(OpenDialog.Filename);
|
|
||||||
NewFilename := FCompilerOpts.ShortenPath(NewFilename, False);
|
|
||||||
if Sender = btnUnitOutputDir then
|
if Sender = btnUnitOutputDir then
|
||||||
UnitOutputDirEdit.Text := OpenDialog.Filename;
|
UnitOutputDirEdit.Text := OpenDialog.Filename;
|
||||||
end;
|
|
||||||
finally
|
finally
|
||||||
OpenDialog.Free;
|
OpenDialog.Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user