Browse Source

* Allow vcl-compat to be compiled for webassembly

Michaël Van Canneyt 1 year ago
parent
commit
1b0a1254ad
2 changed files with 15 additions and 14 deletions
  1. 1 1
      packages/vcl-compat/fpmake.pp
  2. 14 13
      packages/vcl-compat/src/system.ioutils.pp

+ 1 - 1
packages/vcl-compat/fpmake.pp

@@ -19,7 +19,7 @@ begin
     P.HomepageURL := 'www.freepascal.org';
     P.Email := '';
     P.Description := 'Various non-visual VCL compatibility units.';
-    P.OSes := [beos,haiku,freebsd,darwin,iphonesim,ios,solaris,netbsd,openbsd,linux,win32,win64,wince,aix,amiga,aros,morphos,dragonfly,android];
+    P.OSes := [beos,haiku,freebsd,darwin,iphonesim,ios,solaris,netbsd,openbsd,linux,win32,win64,wince,aix,amiga,aros,morphos,dragonfly,android,wasi];
     if Defaults.CPU=jvm then
       P.OSes := P.OSes - [java,android];
 

+ 14 - 13
packages/vcl-compat/src/system.ioutils.pp

@@ -444,7 +444,7 @@ begin
 
   if Length(DriveSeparator)>0 then
   begin
-    {$ifdef UNIX}
+    {$if defined(UNIX) or defined(WASI)}
     FVolumeSeparatorChar     := DriveSeparator[1]
     {$else}
     FVolumeSeparatorChar     := DriveSeparator
@@ -906,19 +906,20 @@ begin
   Result:=Combine([Path1,Path2,Path3,Path4],ValidateParams);
 end;
 
+function AppendPathDelim(const Path: string): string;
+begin
+  if (Path = '') or (Path[Length(Path)] in AllowDirectorySeparators)
+  {$ifdef mswindows}
+    //don't add a PathDelim to e.g. 'C:'
+    or ((Length(Path) = 2) and (Path[2] = ':') and (UpCase(Path[1]) in ['A'..'Z']))
+  {$endif}
+  then
+    Result:=Path
+  else
+    Result:=Path + DirectorySeparator;
+end;
+
 class function TPath.Combine(const Paths: array of string; const ValidateParams: Boolean = True): string;
-  function AppendPathDelim(const Path: string): string;
-  begin
-    if (Path = '') or (Path[Length(Path)] in AllowDirectorySeparators)
-    {$ifdef mswindows}
-      //don't add a PathDelim to e.g. 'C:'
-      or ((Length(Path) = 2) and (Path[2] = ':') and (UpCase(Path[1]) in ['A'..'Z']))
-    {$endif}
-    then
-      Result:=Path
-    else
-      Result:=Path + DirectorySeparator;
-  end;
 var
   i: Integer;
   Path: String;