Better-defined root directory.
- If running from a JAR, the root directory will be the same directory as the JAR (not where it was launched). - Otherwise, use the current working directory. - XDG unaffected. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -41,6 +41,7 @@ import java.net.SocketTimeoutException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.X509Certificate;
|
||||
@@ -541,6 +542,14 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current working directory.
|
||||
* @return the directory
|
||||
*/
|
||||
public static File getWorkingDirectory() {
|
||||
return Paths.get(".").toAbsolutePath().normalize().toFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the integer string argument as a boolean:
|
||||
* {@code 1} is {@code true}, and all other values are {@code false}.
|
||||
|
||||
Reference in New Issue
Block a user