Skip to content

Commit

Permalink
Support the workflow under Windows. #9
Browse files Browse the repository at this point in the history
Use hardcoded '/' as the file separator in getRelativePath and getAbsolutePath.

For file operations, Java will interpret the Unix file separator ("/") as if it were the file separator even when running in windows. Internally paths are used as keys and need to be consistent. Some of these paths are constructed programmatically, others are read from zip file directories, etc. It is better to adopt the simple standard to always use "/" as the separator.

Closes #26

PiperOrigin-RevId: 236383428
  • Loading branch information
lgemeinhardt authored and copybara-github committed Mar 1, 2019
1 parent 040069f commit 136c558
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@ private static String getRelativePath(Type type) {
TypeDeclaration typeDeclaration = type.getDeclaration();
String typeName = typeDeclaration.getSimpleBinaryName();
String packageName = typeDeclaration.getPackageName();
return packageName.replace(".", File.separator) + File.separator + typeName;
return packageName.replace('.', '/') + '/' + typeName;
}

/** Returns the absolute binary path for a given type. */
private static String getAbsolutePath(CompilationUnit compilationUnit, Type type) {
TypeDeclaration typeDeclaration = type.getDeclaration();
String typeName = typeDeclaration.getSimpleBinaryName();
return compilationUnit.getDirectoryPath() + File.separator + typeName;
return compilationUnit.getDirectoryPath() + '/' + typeName;
}
}

0 comments on commit 136c558

Please sign in to comment.