Closed rschmukler closed 4 years ago
Thanks, I'll add it as a test case and see how it could be fixed.
One thing to keep in mind that relative paths for this can be tricky because the JVM has its own classpath to which it calculates relative positions. If you use this in configuration files or scripts it might break easily. @rschmukler do you happen to know how other JVM storage solutions handle this?
@whilo I'm not too sure of the intricacies of getting the current working directory from the JVM. Historically I have used (.getAbsolutePath (io/file ""))
to retrieve it. This works well, at least for Linux / MacOS based systems that I've used.
Looking at Raynes/fs it looks like they do something similar in their cwd
implementation.
Yes, I think we can support it with this semantics in file URLs.
should i try my luck @kordano
While trying some solutions it seems to me that this is working as URIs are expected to be working. RFC3986 3.3 states following:
The path segments "." and "..", also known as dot-segments, are defined for relative reference within the path name hierarchy. They are intended for use at the beginning of a relative-path reference (Section 4.2) to indicate relative position within the hierarchical tree of names. This is similar to their role within some operating systems' file directory structures to indicate the current directory and parent directory, respectively. However, unlike in a file system, these dot-segments are only interpreted within the URI path hierarchy and are removed as part of the resolution process (Section 5.2). This means when using a URI for configuration it is not supposed to work with relative file paths like one would expect coming from a CLI. Relative file paths are only solved relative to the first path segement like
/tmp/
or defaults to root/
. Some examples:
./datahike
resolves to /datahike
/tmp/foo/../datahike
resolves to /tmp/datahike
/tmp/foo/.././datahike
resolves to /tmp/datahike
/tmp/foo/../../datahike
resolves to /datahike
There is no such thing like $PWD
or $HOME
for a URI. You can even try this in your browser.
A solution would be to hack around with the string returned from the URI-object. I would not recommend that. Better is to use a map as for configuring datahike like it is already possible and even more so with the new configuration approach.
This issue should be resolved as invalid.
@TimoKramer thanks for taking the time to research this and provide the explaination. I just confirmed that the relative path in the {:backend :file :path _}
did indeed work. Sorry for the hassle!
Hey! Thanks for this amazing library.
In my application I'd like to open a database at a relative file path. I've tried many permutations of paths but all seem to throw errors in one form or another. See below for my attempts and their results. Is this possible?
(Presumably trying to write to
/data
instead of./data
)Both throw: