This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git

commit 0c892922f29569ac02aa599d3883de6ba812bb22
Author: Josh Tynjala <joshtynj...@apache.org>
AuthorDate: Mon Nov 19 12:33:59 2018 -0800

    compiler-jx: JSWriter uses forward slashes for relative paths because web 
browser devtools prefers this formatting
---
 .../org/apache/royale/compiler/internal/codegen/js/JSWriter.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSWriter.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSWriter.java
index 50b0be2..47cf0ec 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSWriter.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/codegen/js/JSWriter.java
@@ -135,13 +135,16 @@ public class JSWriter implements IJSWriter
         List<IMappingEmitter.SourceMapMapping> mappings = 
emitter.getSourceMapMappings();
         for (IMappingEmitter.SourceMapMapping mapping : mappings)
         {
-            mapping.sourcePath = relativePath(mapping.sourcePath, 
relativeToFile.getAbsolutePath());
+            String relativePath = relativize(mapping.sourcePath, 
relativeToFile.getAbsolutePath());
+            //prefer forward slash
+            relativePath = relativePath.replace('\\', '/');
+            mapping.sourcePath = relativePath;
         }
     }
 
     //if we ever support Java 7, the java.nio.file.Path relativize() method
     //should be able to replace this method
-    private String relativePath(String filePath, String relativeToFilePath)
+    private String relativize(String filePath, String relativeToFilePath)
     {
         boolean caseInsensitive = 
System.getProperty("os.name").toLowerCase().startsWith("windows");
         if(caseInsensitive)

Reply via email to