|
@@ -53,7 +53,7 @@ var
|
|
argv: PPChar;
|
|
argv: PPChar;
|
|
envp: PPChar;
|
|
envp: PPChar;
|
|
|
|
|
|
-function ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd_path: RawByteString): Boolean;
|
|
|
|
|
|
+function ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd_path: RawByteString): Word;
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
@@ -108,7 +108,7 @@ begin
|
|
__wasi_proc_exit(ExitCode);
|
|
__wasi_proc_exit(ExitCode);
|
|
End;
|
|
End;
|
|
|
|
|
|
-function Do_ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd_path: RawByteString): Boolean;
|
|
|
|
|
|
+function Do_ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd_path: RawByteString): Word;
|
|
var
|
|
var
|
|
drive_nr,I,pdir_drive,longest_match,chridx: longint;
|
|
drive_nr,I,pdir_drive,longest_match,chridx: longint;
|
|
IsAbsolutePath: Boolean;
|
|
IsAbsolutePath: Boolean;
|
|
@@ -130,8 +130,7 @@ begin
|
|
{ if so, convert to absolute }
|
|
{ if so, convert to absolute }
|
|
if (drive_nr>=drives_count) or (current_dirs[drive_nr].dir_name='') then
|
|
if (drive_nr>=drives_count) or (current_dirs[drive_nr].dir_name='') then
|
|
begin
|
|
begin
|
|
- InOutRes:=15;
|
|
|
|
- Do_ConvertToFdRelativePath:=false;
|
|
|
|
|
|
+ Do_ConvertToFdRelativePath:=15;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
if current_dirs[drive_nr].dir_name[Length(current_dirs[drive_nr].dir_name)] in AllowDirectorySeparators then
|
|
if current_dirs[drive_nr].dir_name[Length(current_dirs[drive_nr].dir_name)] in AllowDirectorySeparators then
|
|
@@ -140,7 +139,6 @@ begin
|
|
path:=current_dirs[drive_nr].dir_name+DirectorySeparator+path;
|
|
path:=current_dirs[drive_nr].dir_name+DirectorySeparator+path;
|
|
end;
|
|
end;
|
|
{ path is now absolute. Try to find it in the preopened dirs array }
|
|
{ path is now absolute. Try to find it in the preopened dirs array }
|
|
- Do_ConvertToFdRelativePath:=false;
|
|
|
|
longest_match:=0;
|
|
longest_match:=0;
|
|
for I:=0 to preopened_dirs_count-1 do
|
|
for I:=0 to preopened_dirs_count-1 do
|
|
begin
|
|
begin
|
|
@@ -166,16 +164,15 @@ begin
|
|
Inc(chridx);
|
|
Inc(chridx);
|
|
fd:=preopened_dirs[I].fd;
|
|
fd:=preopened_dirs[I].fd;
|
|
relfd_path:=Copy(path,chridx,Length(path)-chridx+1);
|
|
relfd_path:=Copy(path,chridx,Length(path)-chridx+1);
|
|
- Do_ConvertToFdRelativePath:=true;
|
|
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
if longest_match>0 then
|
|
if longest_match>0 then
|
|
- InOutRes:=0
|
|
|
|
|
|
+ Do_ConvertToFdRelativePath:=0
|
|
else
|
|
else
|
|
- InOutRes:=3;
|
|
|
|
|
|
+ Do_ConvertToFdRelativePath:=3;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd_path: RawByteString): Boolean;
|
|
|
|
|
|
+function ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd_path: RawByteString): Word;
|
|
begin
|
|
begin
|
|
ConvertToFdRelativePath:=Do_ConvertToFdRelativePath(ToSingleByteFileSystemEncodedFileName(path),fd,relfd_path);
|
|
ConvertToFdRelativePath:=Do_ConvertToFdRelativePath(ToSingleByteFileSystemEncodedFileName(path),fd,relfd_path);
|
|
setcodepage(relfd_path,DefaultRTLFileSystemCodePage,true);
|
|
setcodepage(relfd_path,DefaultRTLFileSystemCodePage,true);
|