mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-09 02:28:27 +01:00
IDE: save new package unit: set initialdir to package dir
git-svn-id: trunk@35600 -
This commit is contained in:
parent
e82a9ebdb8
commit
f441b83baf
@ -717,7 +717,7 @@ type
|
||||
procedure ShortenFilename(var ExpandedFilename: string; UseUp: boolean);
|
||||
procedure LongenFilename(var AFilename: string);
|
||||
function FindPkgFile(const AFilename: string;
|
||||
IgnoreRemoved, FindNewFile: boolean): TPkgFile;
|
||||
IgnoreRemoved, FindVirtualFile: boolean): TPkgFile;
|
||||
function FindUnitWithRegister(IgnorePkgFile: TPkgFile = nil): TPkgFile;
|
||||
function FindUnit(const TheUnitName: string): TPkgFile;
|
||||
function FindUnit(const TheUnitName: string; IgnoreRemoved: boolean): TPkgFile;
|
||||
@ -3086,8 +3086,8 @@ begin
|
||||
Result:=FComponents.IndexOf(PkgComponent);
|
||||
end;
|
||||
|
||||
function TLazPackage.FindPkgFile(const AFilename: string;
|
||||
IgnoreRemoved, FindNewFile: boolean): TPkgFile;
|
||||
function TLazPackage.FindPkgFile(const AFilename: string; IgnoreRemoved,
|
||||
FindVirtualFile: boolean): TPkgFile;
|
||||
var
|
||||
TheFilename: String;
|
||||
Cnt: Integer;
|
||||
@ -3097,20 +3097,11 @@ begin
|
||||
|
||||
TheFilename:=AFilename;
|
||||
|
||||
if FindNewFile and (not FilenameIsAbsolute(TheFilename)) then begin
|
||||
// this is a virtual file, not yet saved
|
||||
// -> prepend Package Directory and check if it does not exists yet in
|
||||
// the package directory
|
||||
LongenFilename(TheFilename);
|
||||
if FileExistsUTF8(TheFilename) then begin
|
||||
// the file exists -> this virtual file does not belong to the package
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
Cnt:=FileCount;
|
||||
for i:=0 to Cnt-1 do begin
|
||||
Result:=Files[i];
|
||||
if (not FindVirtualFile) and (not FilenameIsAbsolute(Result.Filename)) then
|
||||
continue;
|
||||
if (CompareFilenames(Result.Filename,TheFilename)=0)
|
||||
or (CompareFilenames(Result.GetFullFilename,TheFilename)=0) then
|
||||
exit;
|
||||
@ -3119,6 +3110,8 @@ begin
|
||||
Cnt:=RemovedFilesCount;
|
||||
for i:=0 to Cnt-1 do begin
|
||||
Result:=RemovedFiles[i];
|
||||
if (not FindVirtualFile) and (not FilenameIsAbsolute(Result.Filename)) then
|
||||
continue;
|
||||
if (CompareFilenames(Result.Filename,TheFilename)=0)
|
||||
or (CompareFilenames(Result.GetFullFilename,TheFilename)=0) then
|
||||
exit;
|
||||
|
||||
@ -207,7 +207,7 @@ type
|
||||
var File1: TPkgFile;
|
||||
var ConflictPkg: TLazPackage): boolean;
|
||||
function FindFileInAllPackages(const TheFilename: string;
|
||||
IgnoreDeleted, FindNewFile: boolean): TPkgFile;
|
||||
IgnoreDeleted, FindVirtualFile: boolean): TPkgFile;
|
||||
procedure FindPossibleOwnersOfUnit(const TheFilename: string;
|
||||
OwnerList: TFPList);
|
||||
function FindLowestPkgNodeByName(const PkgName: string): TAVLTreeNode;
|
||||
@ -1185,7 +1185,7 @@ begin
|
||||
end;
|
||||
|
||||
function TLazPackageGraph.FindFileInAllPackages(const TheFilename: string;
|
||||
IgnoreDeleted, FindNewFile: boolean): TPkgFile;
|
||||
IgnoreDeleted, FindVirtualFile: boolean): TPkgFile;
|
||||
var
|
||||
Cnt: Integer;
|
||||
i: Integer;
|
||||
@ -1193,7 +1193,7 @@ begin
|
||||
Cnt:=Count;
|
||||
for i:=0 to Cnt-1 do begin
|
||||
Result:=Packages[i].FindPkgFile(TheFilename,IgnoreDeleted,
|
||||
FindNewFile);
|
||||
FindVirtualFile);
|
||||
if Result<>nil then exit;
|
||||
end;
|
||||
Result:=nil;
|
||||
|
||||
@ -1641,6 +1641,10 @@ var
|
||||
PkgFile: TPkgFile;
|
||||
begin
|
||||
Result:='';
|
||||
if FilenameIsAbsolute(Filename) then begin
|
||||
Result:=ExtractFilePath(Filename);
|
||||
exit;
|
||||
end;
|
||||
PkgFile:=PackageGraph.FindFileInAllPackages(Filename,true,true);
|
||||
if PkgFile=nil then exit;
|
||||
APackage:=PkgFile.LazPackage;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user