trying to sort out path and bits issues for 2.0a2

This commit is contained in:
benfry
2011-11-01 00:47:37 +00:00
parent 2832dcfcf9
commit d01b4e7bf4
6 changed files with 52 additions and 11 deletions
+12 -2
View File
@@ -1151,8 +1151,18 @@ public class JavaBuild {
/// on windows, copy the exe file
if (exportPlatform == PConstants.WINDOWS) {
Base.copyFile(mode.getContentFile("application/template.exe"),
new File(destFolder, sketch.getName() + ".exe"));
if (exportBits == 64) {
// We don't yet have a 64-bit launcher, so this is a workaround for now.
File batFile = new File(destFolder, sketch.getName() + ".bat");
PrintWriter writer = PApplet.createWriter(batFile);
writer.println("@echo off");
writer.println("java -Djava.ext.dirs=lib -Djava.library.path=lib " + sketch.getName());
writer.flush();
writer.close();
} else {
Base.copyFile(mode.getContentFile("application/template.exe"),
new File(destFolder, sketch.getName() + ".exe"));
}
}
+2 -2
View File
@@ -212,7 +212,6 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
#endif
}
/*
SHELLEXECUTEINFO ShExecInfo;
#ifdef DEBUG
@@ -261,8 +260,8 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
}
return 0;
*/
/*
PROCESS_INFORMATION pi;
memset(&pi, 0, sizeof(pi));
STARTUPINFO si;
@@ -298,6 +297,7 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
}
}
return dwExitCode;
*/
}
+28 -2
View File
@@ -6548,8 +6548,8 @@ public class PApplet extends Applet
return sketchPath + File.separator + "data" + File.separator + where;
}
/**
* Return a full path to an item in the data folder as a File object.
* See the dataPath() method for more information.
@@ -6559,6 +6559,32 @@ 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
*/
public File inputFile(String where) {
// isAbsolute() could throw an access exception, but so will writing
// to the local disk using the sketch path, so this is safe here.
File why = new File(where);
if (why.isAbsolute()) return why;
String jarPath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
if (jarPath.contains("Contents/Resources/Java/")) {
File containingFolder = new File(jarPath).getParentFile();
File dataFolder = new File(containingFolder, "data");
return new File(dataFolder, where);
}
// Windows, Linux, or when not using a Mac OS X .app file
return new File(sketchPath + File.separator + "data" + File.separator + where);
}
public String inputPath(String where) {
return inputFile(where).getAbsolutePath();
}
/**
* Takes a path and creates any in-between folders if they don't
* already exist. Useful when trying to save to a subfolder that
+3
View File
@@ -4,6 +4,9 @@ X doing this via a tool instead
X on resize, call redraw() when noLoop() is used
o need to add this to the docs
X was already in the documentation..
X add inputPath()
_ split dataPath() into inputPath() and outputPath()
_ finish adding loadStrings(BufferedReader)
_ decide if we want to keep this (and/or others?)
@@ -438,7 +438,7 @@ public class Capture extends PImage implements PConstants {
}
res = new String[devices.size()];
for (int i = 0; i < res.length; i++) {
res[i] = (String)devices.get(i);
res[i] = devices.get(i);
}
} else {
System.err.println("The capture plugin doesn't support device query!");
@@ -484,7 +484,7 @@ public class Capture extends PImage implements PConstants {
int n = resolutions.size();
res = new Resolution[n];
for (int i = 0; i < n; i++) {
res[i] = new Resolution((Resolution)resolutions.get(i));
res[i] = new Resolution(resolutions.get(i));
}
}
@@ -626,7 +626,7 @@ public class Capture extends PImage implements PConstants {
if (properties != null) {
Iterator<String> it = properties.keySet().iterator();
while (it.hasNext()) {
String name = (String) it.next();
String name = it.next();
Object value = properties.get(name);
gsource.set(name, value);
}
@@ -716,7 +716,7 @@ public class Capture extends PImage implements PConstants {
protected void checkResolutions() {
boolean suppRes = false;
for (int i = 0; i < resolutions.size(); i++) {
Resolution res = (Resolution) resolutions.get(i);
Resolution res = resolutions.get(i);
if (reqWidth == res.width && reqHeight == res.height &&
fps.equals("") || fps.equals(res.fpsString)) {
suppRes = true;
@@ -732,7 +732,7 @@ public class Capture extends PImage implements PConstants {
System.err.println("The requested resolution of " + reqWidth + "x" + reqHeight + fpsStr + " is not supported by selected the capture device.");
System.err.println("Use one of the following resolutions instead:");
for (int i = 0; i < resolutions.size(); i++) {
Resolution res = (Resolution) resolutions.get(i);
Resolution res = resolutions.get(i);
System.err.println(res.toString());
}
}
+2
View File
@@ -11,6 +11,8 @@ X requires change to export/launcher.cpp to include the exe dir
_ this will cause trouble with ...
X change Linux script to handle the 'lib' dir as part of the lib path
X changed Mac OS X launchers, also requiring Java 1.6.
X write .bat file for windows64
_ document that this is temporary / file a bug
// If no bits specified (libs are all universal, or no native libs)
// then exportBits will be 0, and can be controlled via "Get Info".