Java relative paths: trick or treat?
We all had problems with relative paths in Java! Do not deny it!
Every time I have to understand where the path is relative to is a puddle of blood, so how can we unveil this mystery?
- Will it be relative to the classpath?
- Will it be related to the project root?
- And in the tests?
Java: new File(".").getAbsolutePath()
Kotlin: File(".").AbsolutePathSimple and fast, at this point we know exactly where is the starting point for our relative path!
Comments
Post a Comment