summaryrefslogtreecommitdiff
path: root/sources/scalac/ast/parser/SourceRepresentation.java
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac/ast/parser/SourceRepresentation.java')
-rw-r--r--sources/scalac/ast/parser/SourceRepresentation.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/sources/scalac/ast/parser/SourceRepresentation.java b/sources/scalac/ast/parser/SourceRepresentation.java
index 2a20e13fab..4218bc2ead 100644
--- a/sources/scalac/ast/parser/SourceRepresentation.java
+++ b/sources/scalac/ast/parser/SourceRepresentation.java
@@ -8,6 +8,9 @@
package scalac.ast.parser;
+import java.io.File;
+import scalac.util.Name;
+
public final class SourceRepresentation {
public static int digit2int(byte ch, int base) {
@@ -202,4 +205,15 @@ public final class SourceRepresentation {
char[] s = {c};
return escape(new String(s));
}
+
+ /** return external representation of file name s,
+ * converting '.' to File.separatorChar
+ */
+ public static String externalizeFileName(Name n) {
+ if ((n == null) || (n.length() == 0))
+ return ".";
+ byte[] ascii = n.toAscii();
+ String s = ascii2string(ascii, 0, ascii.length);
+ return s.replace('.', File.separatorChar);
+ }
}