Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isAbsolute field to path and treat relative/absolute/~ paths correctly in adaptors #519

Closed
sverhoeven opened this issue Aug 3, 2017 · 3 comments
Assignees

Comments

@sverhoeven
Copy link
Member

No description provided.

@atzeus
Copy link
Contributor

atzeus commented Aug 4, 2017

This is fixed by the pull request #524

@atzeus atzeus closed this as completed Aug 4, 2017
@sverhoeven
Copy link
Member Author

The adaptors don't treat non-absolute paths themselves, they just pass them on their respective clients.

For example passing in a '.' to the file adaptor will return a listing of '/', instead of the expected listing of fs.getEntryPath().

In xenon-cli I now have to use:

public static Path getAbsolutePath(Path pathRelativeOrAbsolute, FileSystem fs) {
    if (pathRelativeOrAbsolute.isAbsolute()) {
        return pathRelativeOrAbsolute;
    } else {
        return fs.getEntryPath().resolve(pathRelativeOrAbsolute);
    }
}

I expected that adaptors would do this relative 2 absolute conversion for me.
I have added some tests to https://github.com/NLeSC/Xenon/tree/relative-file-tests branch that should pass adaptors did the conversion.

@jmaassen Should Xenon adaptors or the users of Xenon do this?

@jmaassen
Copy link
Member

Fixed in 0b622b1

Added working directory and support for relative paths (resolved against this working directory) to all adaptors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants