assets/src/org/ruboto/JRubyAdapter.java in ruboto-0.10.1 vs assets/src/org/ruboto/JRubyAdapter.java in ruboto-0.10.2.rc.0
- old
+ new
@@ -320,12 +320,16 @@
Method setClassLoaderMethod = ruby.getClass().getMethod("setClassLoader", ClassLoader.class);
setClassLoaderMethod.invoke(ruby, classLoader);
Thread.currentThread().setContextClassLoader(classLoader);
- String defaultCurrentDir = appContext.getFilesDir().getPath();
- Log.d("Setting JRuby current directory to " + defaultCurrentDir);
- callScriptingContainerMethod(Void.class, "setCurrentDirectory", defaultCurrentDir);
+ if (appContext.getFilesDir() != null) {
+ String defaultCurrentDir = appContext.getFilesDir().getPath();
+ Log.d("Setting JRuby current directory to " + defaultCurrentDir);
+ callScriptingContainerMethod(Void.class, "setCurrentDirectory", defaultCurrentDir);
+ } else {
+ Log.e("Unable to find app files dir!");
+ }
if (out != null) {
output = out;
setOutputStream(out);
} else if (output != null) {