google / google/closure-compiler

Compilation fails if JavaScript files are on a different volume than the Closure Compiler

Open
#2,589 4 comments 0 reactions 0 assignees View on GitHub
internal-issue-created P3 triage-done
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

If the Closure Compiler is running on one volume (say, the C drive) and your JavaScript files are on a different drive (say, the D drive), compilation will fail with the following exception:

```
java.lang.IllegalArgumentException: 'other' has different root
```

The source of the error is [CompileTask, line 660](https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/ant/CompileTask.java#L660), where it tries to call [`Path.relativize(Path other)`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html#relativize-java.nio.file.Path-) on `Paths.get("")`, which gets the current working directory. Unfortunately, the current working directory is on a different volume, and the above error is thrown. Tested on Windows 7.

Would it be possible to either create a different algorithm for finding the paths, or allow the current working directory to be overridden instead of dependent on `Paths.get("")`?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.