mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 14:29:14 +02:00
pastojs: fixed DirectoryExists using FileAttr
git-svn-id: trunk@43159 -
This commit is contained in:
parent
e0041a8244
commit
01f82551a4
@ -905,17 +905,25 @@ end;
|
||||
|
||||
function TPas2jsCachedDirectories.DirectoryExists(Filename: string): boolean;
|
||||
var
|
||||
Info: TFileInfo;
|
||||
Dir: TPas2jsCachedDirectory;
|
||||
begin
|
||||
Dir:=GetDirectory(Filename,true,false);
|
||||
if Dir<>nil then
|
||||
Result:=Dir.Count>0
|
||||
Info.Filename:=Filename;
|
||||
if not GetFileInfo(Info) then exit(false);
|
||||
if Info.Dir<>nil then
|
||||
Result:=(Info.Dir.FileAttr(Info.ShortFilename) and faDirectory)>0
|
||||
else
|
||||
begin
|
||||
Filename:=ChompPathDelim(ResolveDots(Filename));
|
||||
if not FilenameIsAbsolute(Filename) then
|
||||
Filename:=WorkingDirectory+Filename;
|
||||
Result:={$IFDEF pas2js}NodeJSFS{$ELSE}SysUtils{$ENDIF}.DirectoryExists(Filename);
|
||||
Dir:=GetDirectory(Filename,true,false);
|
||||
if Dir<>nil then
|
||||
Result:=Dir.Count>0
|
||||
else
|
||||
begin
|
||||
Filename:=ChompPathDelim(ResolveDots(Filename));
|
||||
if not FilenameIsAbsolute(Filename) then
|
||||
Filename:=WorkingDirectory+Filename;
|
||||
Result:={$IFDEF pas2js}NodeJSFS{$ELSE}SysUtils{$ENDIF}.DirectoryExists(Filename);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user