mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 20:59:08 +02:00
Converter: Use the path selected by user when searching for missing units. It used the same path always
git-svn-id: trunk@39294 -
This commit is contained in:
parent
773c2fe670
commit
2d498b4135
@ -69,7 +69,7 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure Execute; override;
|
procedure Execute; override;
|
||||||
public
|
public
|
||||||
constructor Create(aConverter: TConvertDelphiPBase);
|
constructor Create(aConverter: TConvertDelphiPBase; aPath: string);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
public
|
public
|
||||||
property Searcher: TFileSearcher read fSearcher;
|
property Searcher: TFileSearcher read fSearcher;
|
||||||
@ -407,6 +407,7 @@ begin
|
|||||||
fn:=ExtractFileName(RelPath);
|
fn:=ExtractFileName(RelPath);
|
||||||
sUnitName:=ExtractFileNameOnly(fn);
|
sUnitName:=ExtractFileNameOnly(fn);
|
||||||
if (SubPath<>'') and (sUnitName<>'') then begin
|
if (SubPath<>'') and (sUnitName<>'') then begin
|
||||||
|
//DebugLn(['RelPath=',RelPath,'SubPath=',SubPath,'fn=',fn,'sUnitName=',sUnitName]);
|
||||||
// Map path by unit name.
|
// Map path by unit name.
|
||||||
fConverter.fCachedUnitNames[sUnitName]:=SubPath;
|
fConverter.fCachedUnitNames[sUnitName]:=SubPath;
|
||||||
// Map real unit name by uppercase unit name.
|
// Map real unit name by uppercase unit name.
|
||||||
@ -421,14 +422,14 @@ end;
|
|||||||
|
|
||||||
{ TCacheUnitsThread }
|
{ TCacheUnitsThread }
|
||||||
|
|
||||||
constructor TCacheUnitsThread.Create(aConverter: TConvertDelphiPBase);
|
constructor TCacheUnitsThread.Create(aConverter: TConvertDelphiPBase; aPath: string);
|
||||||
begin
|
begin
|
||||||
inherited Create(True);
|
inherited Create(True);
|
||||||
FreeOnTerminate:=True;
|
FreeOnTerminate:=True;
|
||||||
// Create searcher already now. Its Stop method can be called anytime.
|
// Create searcher already now. Its Stop method can be called anytime.
|
||||||
fSearcher:=TUnitsSearcher.Create(aConverter);
|
fSearcher:=TUnitsSearcher.Create(aConverter);
|
||||||
// The parent directory to be scanned
|
// The parent directory to be scanned
|
||||||
fPath:=TrimFilename(aConverter.fSettings.MainPath+'..'+DirectorySeparator);
|
fPath:=aPath;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCacheUnitsThread.Destroy;
|
destructor TCacheUnitsThread.Destroy;
|
||||||
@ -718,10 +719,10 @@ begin
|
|||||||
fOwnerConverter.fPrevSelectedPath:=ExtractFilePath(UnitDirDialog.Filename);
|
fOwnerConverter.fPrevSelectedPath:=ExtractFilePath(UnitDirDialog.Filename);
|
||||||
// Add the new path to project if missing units are found.
|
// Add the new path to project if missing units are found.
|
||||||
// We use a thread here only to reuse its code. No parallel operations now.
|
// We use a thread here only to reuse its code. No parallel operations now.
|
||||||
CacheUnitsThread:=TCacheUnitsThread.Create(fOwnerConverter);
|
CacheUnitsThread:=TCacheUnitsThread.Create(fOwnerConverter,
|
||||||
|
fOwnerConverter.fPrevSelectedPath);
|
||||||
CacheUnitsThread.Start;
|
CacheUnitsThread.Start;
|
||||||
CacheUnitsThread.WaitFor; // Make sure the thread has finished before continuing.
|
CacheUnitsThread.WaitFor; // Make sure the thread has finished before continuing.
|
||||||
// fOwnerConverter.CacheUnitsInPath(UnitDirDialog.Filename);
|
|
||||||
TryAgain:=fOwnerConverter.DoMissingUnits(fUsedUnitsTool)>0;
|
TryAgain:=fOwnerConverter.DoMissingUnits(fUsedUnitsTool)>0;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -815,10 +816,12 @@ begin
|
|||||||
fSettings:=TConvertSettings.Create(ADescription);
|
fSettings:=TConvertSettings.Create(ADescription);
|
||||||
fSettings.MainFilename:=fOrigFilename;
|
fSettings.MainFilename:=fOrigFilename;
|
||||||
fIsConsoleApp:=False; // Default = GUI app.
|
fIsConsoleApp:=False; // Default = GUI app.
|
||||||
|
fPrevSelectedPath:=fSettings.MainPath;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TConvertDelphiPBase.Destroy;
|
destructor TConvertDelphiPBase.Destroy;
|
||||||
begin
|
begin
|
||||||
|
fSettings.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -907,14 +910,12 @@ begin
|
|||||||
fAllCommentedUnits:=TStringList.Create;
|
fAllCommentedUnits:=TStringList.Create;
|
||||||
fAllCommentedUnits.Sorted:=true;
|
fAllCommentedUnits.Sorted:=true;
|
||||||
fUnitsToAddToProject:=TStringList.Create;
|
fUnitsToAddToProject:=TStringList.Create;
|
||||||
fPrevSelectedPath:=fSettings.MainPath;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TConvertDelphiProjPack.Destroy;
|
destructor TConvertDelphiProjPack.Destroy;
|
||||||
begin
|
begin
|
||||||
fUnitsToAddToProject.Free;
|
fUnitsToAddToProject.Free;
|
||||||
fAllCommentedUnits.Free;
|
fAllCommentedUnits.Free;
|
||||||
fSettings.Free;
|
|
||||||
fCachedRealFileNames.Free;
|
fCachedRealFileNames.Free;
|
||||||
fCachedUnitNames.Free;
|
fCachedUnitNames.Free;
|
||||||
fUnitSearchPaths.Free;
|
fUnitSearchPaths.Free;
|
||||||
@ -936,7 +937,8 @@ begin
|
|||||||
IDEMessagesWindow.Clear;
|
IDEMessagesWindow.Clear;
|
||||||
// Start scanning unit files one level above project path. The GUI will appear
|
// Start scanning unit files one level above project path. The GUI will appear
|
||||||
// without delay but then we must wait for the thread before continuing.
|
// without delay but then we must wait for the thread before continuing.
|
||||||
CacheUnitsThread:=TCacheUnitsThread.Create(Self);
|
CacheUnitsThread:=TCacheUnitsThread.Create(Self,
|
||||||
|
TrimFilename(fSettings.MainPath+'..'+DirectorySeparator));
|
||||||
try
|
try
|
||||||
Result:=fSettings.RunForm(CacheUnitsThread); // Get settings from user.
|
Result:=fSettings.RunForm(CacheUnitsThread); // Get settings from user.
|
||||||
if Result=mrOK then begin
|
if Result=mrOK then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user