Encode all path-related strings explicitly as
Fixes
MODIFY
runtime/src/jycessing/LibraryImporter.java
runtime/src/jycessing/LibraryImporter.java
@@ -151,7 +151,7 @@ class LibraryImporter {
addJarToClassLoader(resource.getAbsoluteFile());
log("Appending " + resource.getAbsolutePath() + " to sys.path.");
- sys.path.append(Py.newString(resource.getAbsolutePath()));
+ sys.path.append(Py.newStringUTF8(resource.getAbsolutePath()));
} else if (name.matches("^.*\\.(so|dll|dylib|jnilib)$")) {
// Add *containing directory* to native search path
addDirectoryToNativeSearchPath(resource.getAbsoluteFile().getParentFile());

MODIFY
runtime/src/jycessing/PAppletJythonDriver.java
runtime/src/jycessing/PAppletJythonDriver.java
@@ -405,7 +405,7 @@ public class PAppletJythonDriver extends PApplet {
this.interp = interp;
this.builtins = (PyStringMap) interp.getSystemState().getBuiltins();
- interp.set("__file__", new File(pySketchPath).getName());
+ interp.set("__file__", Py.newStringUTF8(new File(pySketchPath).getName()));
processSketch(DETECT_MODE_SCRIPT);
this.mode = Mode.valueOf(interp.get("__mode__").asString());
Runner.log("Mode: ", mode.name());

MODIFY
runtime/src/jycessing/Runner.java
runtime/src/jycessing/Runner.java
@@ -353,7 +353,7 @@ public class Runner {
}
for (final String lib : userLibs) {
- sys.path.insert(0, Py.newString(lib));
+ sys.path.insert(0, Py.newStringUTF8(lib));
}
// Make fake "launcher" module available to sketches - will only work with standalone sketches
@@ -367,7 +367,7 @@ public class Runner {
* bound methods (such as loadImage(), noSmooth(), noise(), etc.) in the builtins
* namespace.
*/
- interp.set("__cwd__", sketch.getHomeDirectory().getAbsolutePath());
+ interp.set("__cwd__", Py.newStringUTF8(sketch.getHomeDirectory().getAbsolutePath()));
interp.set("__python_mode_build__", BUILD_NUMBER);
interp.set("__stdout__", stdout);
interp.set("__stderr__", stderr);

Encode all path-related strings explicitly as UTF-8.

Fixes https://github.com/jdf/Processing.py-Bugs/issues/202