fix dataPath() for OS X and Java 7

This commit is contained in:
Ben Fry
2013-10-27 14:26:20 -04:00
parent 76f99a232f
commit 8a0a226eb7
2 changed files with 11 additions and 3 deletions

View File

@@ -7844,7 +7844,7 @@ public class PApplet extends Applet
* This is only available with applications, not applets or Android.
* On Windows and Linux, this is simply the data folder, which is located
* in the same directory as the EXE file and lib folders. On Mac OS X, this
* is a path to the data folder buried inside Contents/Resources/Java.
* is a path to the data folder buried inside Contents/Java.
* For the latter point, that also means that the data folder should not be
* considered writable. Use sketchPath() for now, or inputPath() and
* outputPath() once they're available in the 2.0 release.
@@ -7871,11 +7871,12 @@ public class PApplet extends Applet
String jarPath =
getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
if (jarPath.contains("Contents/Resources/Java/")) {
if (jarPath.contains("Contents/Java/")) {
// The path will be URL encoded (%20 for spaces) coming from above
// http://code.google.com/p/processing/issues/detail?id=1073
File containingFolder = new File(urlDecode(jarPath)).getParentFile();
File dataFolder = new File(containingFolder, "data");
System.out.println(dataFolder);
return new File(dataFolder, where);
}
// Windows, Linux, or when not using a Mac OS X .app file
@@ -7885,7 +7886,7 @@ public class PApplet extends Applet
/**
* On Windows and Linux, this is simply the data folder. On Mac OS X, this is
* the path to the data folder buried inside Contents/Resources/Java
* the path to the data folder buried inside Contents/Java
*/
// public File inputFile(String where) {
// }

View File

@@ -1,4 +1,9 @@
0223 core
X fix
X Zero Alpha Values from Pixels Array (fixed in previous?)
X https://github.com/processing/processing/issues/2030
_ only tested on background(), not image()
opengl
X Using sketchQuality() does not work properly with P3D, OPENGL, P2D
@@ -20,6 +25,8 @@ X Add warning when no uv texture coordinates are supplied
X https://github.com/processing/processing/issues/2034
X threading/flicker issues when resizing P2D/P3D/OPENGL
X https://github.com/processing/processing/issues/15
X additional flicker avoidance
X https://github.com/processing/processing/commit/cca2f08a24ef892c494f5a75aa0e4b01de7e5d8a
high
_ Sort out blending differences with P2D/P3D