diff options
Diffstat (limited to 'src/java/File.hxx')
-rw-r--r-- | src/java/File.hxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/java/File.hxx b/src/java/File.hxx index e7a1a5363..b49cd30b8 100644 --- a/src/java/File.hxx +++ b/src/java/File.hxx @@ -31,6 +31,7 @@ #define JAVA_FILE_HXX #include "Object.hxx" +#include "String.hxx" #include <jni.h> @@ -51,11 +52,19 @@ public: static void Initialise(JNIEnv *env) noexcept; gcc_nonnull_all - static jstring getAbsolutePath(JNIEnv *env, jobject file) noexcept { + static jstring GetAbsolutePath(JNIEnv *env, jobject file) noexcept { return (jstring)env->CallObjectMethod(file, getAbsolutePath_method); } + String GetAbsolutePath() const noexcept { + return {GetEnv(), GetAbsolutePath(GetEnv(), Get())}; + } + + String GetAbsolutePathChecked() const noexcept { + return *this ? GetAbsolutePath() : nullptr; + } + /** * Invoke File.getAbsolutePath() and release the * specified File reference. |