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
Allow short relative paths in imports #573
Conversation
Codecov Report
@@ Coverage Diff @@
## master #573 +/- ##
=========================================
Coverage 77.35% 77.36%
- Complexity 2981 2984 +3
=========================================
Files 499 499
Lines 11499 11503 +4
Branches 666 667 +1
=========================================
+ Hits 8895 8899 +4
Misses 2377 2377
Partials 227 227 |
@armiol, PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmdashenkov please see my comments.
@Test | ||
@DisplayName("obtain the empty directory path") | ||
void emptyDirectory() { | ||
FileReference file = FileReference.of("./neighbour.txt"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I would expect that the /
symbol here would be a system-specific path delimiter. I don't know, but it seems to me that some Windows versions would gladly interpret .\neighbour.txt
as a file in the current folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is an imported file reference, we only use this /
type of slashes.
/** | ||
* Obtains the reference to the current directory. | ||
*/ | ||
public static DirectoryReference currentDir() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to my comment below, I would expect that the reference to the current dir would be either "."
or "." + File.separatorChar
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to remove the ".
" symbols, as they are not very helpful for resolving imports.
This PR fixes a crash in
FileReference.directory()
. Currently, the method throws an exception if the file reference has no directory, i.e. it's a simple file name (possibly, with the "./
" prefix). This PR fixes that crash.