Browse Source

pastojs: added AlwaysRequireSharedBaseFolder to TryCreateRelativePath

git-svn-id: trunk@42877 -
Mattias Gaertner 6 years ago
parent
commit
deed93bbfb

+ 1 - 1
packages/pastojs/src/pas2jscompiler.pp

@@ -2259,7 +2259,7 @@ begin
     MapFilename:=LocalFilename;
     if (BaseDir<>'') and not SrcMapFilenamesAbsolute then
     begin
-      if not FS.TryCreateRelativePath(LocalFilename,BaseDir,true,MapFilename) then
+      if not FS.TryCreateRelativePath(LocalFilename,BaseDir,true,false,MapFilename) then
       begin
         // e.g. file is on another partition
         if not SrcMapInclude then

+ 6 - 4
packages/pastojs/src/pas2jsfilecache.pp

@@ -279,7 +279,8 @@ type
     function ExpandExecutable(const Filename: string): string; override;
     function HandleOptionPaths(C: Char; aValue: String; FromCmdLine: Boolean): String; override;
     Function AddForeignUnitPath(const aValue: String; FromCmdLine: Boolean): String; override;
-    function TryCreateRelativePath(const Filename, BaseDirectory: String; UsePointDirectory: boolean; out RelPath: String): Boolean; override;
+    function TryCreateRelativePath(const Filename, BaseDirectory: String;
+      UsePointDirectory, AlwaysRequireSharedBaseFolder: boolean; out RelPath: String): Boolean; override;
   Protected
     property DirectoryCache: TPas2jsCachedDirectories read FDirectoryCache;
   public
@@ -1806,11 +1807,12 @@ begin
   AddSrcUnitPaths(aValue,FromCmdLine,Result);
 end;
 
-function TPas2jsFilesCache.TryCreateRelativePath(const Filename, BaseDirectory: String;
-  UsePointDirectory: boolean; out RelPath: String): Boolean;
+function TPas2jsFilesCache.TryCreateRelativePath(const Filename,
+  BaseDirectory: String; UsePointDirectory,
+  AlwaysRequireSharedBaseFolder: boolean; out RelPath: String): Boolean;
 begin
   Result:=Pas2jsFileUtils.TryCreateRelativePath(Filename, BaseDirectory,
-    UsePointDirectory, false, RelPath);
+    UsePointDirectory, AlwaysRequireSharedBaseFolder, RelPath);
 end;
 
 function TPas2jsFilesCache.FindIncludeFileName(const aFilename,

+ 5 - 3
packages/pastojs/src/pas2jsfs.pp

@@ -115,7 +115,8 @@ Type
     function ExpandExecutable(const Filename: string): string; virtual;
     Function FormatPath(Const aFileName: string): String; virtual;
     Function DirectoryExists(Const aDirectory: string): boolean; virtual;
-    function TryCreateRelativePath(const Filename, BaseDirectory: String; UsePointDirectory: boolean; out RelPath: String): Boolean; virtual;
+    function TryCreateRelativePath(const Filename, BaseDirectory: String;
+      UsePointDirectory, AlwaysRequireSharedBaseFolder: boolean; out RelPath: String): Boolean; virtual;
     procedure DeleteDuplicateFiles(List: TStrings); virtual;
     function IndexOfFile(FileList: TStrings; aFilename: string; Start: integer = 0): integer; virtual;// -1 if not found
     Procedure WriteFoldersAndSearchPaths; virtual;
@@ -255,12 +256,13 @@ begin
   Result:=aDirectory='';
 end;
 
-function TPas2JSFS.TryCreateRelativePath(const Filename, BaseDirectory: String; UsePointDirectory: boolean; out RelPath: String
+function TPas2JSFS.TryCreateRelativePath(const Filename, BaseDirectory: String;
+  UsePointDirectory, AlwaysRequireSharedBaseFolder: boolean; out RelPath: String
   ): Boolean;
 begin
   Result:=True;
   RelPath:=FileName;
-  if (BaseDirectory='') or UsePointDirectory then ;
+  if (BaseDirectory='') or UsePointDirectory or AlwaysRequireSharedBaseFolder then ;
 end;
 
 procedure TPas2JSFS.DeleteDuplicateFiles(List: TStrings);