Skip to content

Possible issue with usage of File.getCanonicalPath() #50

Description

@iadcode

Pull Request #47 changed the sources list to be transformed through File.getCanonicalPath().
Additionally, in SbtJsTask.executeSourceFilesJs, a file is transformed by File.getCanonicalPath().

I question the use of .getCanonicalPath() over .getAbsolutePath(). On UNIX environments, .getCanonicalPath() will resolve symbolic links. With the inconsistent usage of .getCanonicalPath() throughout SbtJsTask, I think this causes issues when mapping output files to source files, or trying to locate source/output files relative to some folders.

I have created an example using Play to demonstrate this in practice at objectmastery/canonical-error-example. The example uses a project/subproject setup, with a symbolic link from the main project to the sub project. This reflects a setup I already have working fine on Windows, with a subproject being symbolically linked to by multiple other main projects (code sharing! yay!).

Of course, there's always a chance .getCanonicalPath() is all fine and I'm just doing something strange, so feel free to point that out instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions