move location of prefs and sketchbook, fixed nasty bugs

This commit is contained in:
benfry
2004-07-16 06:32:00 +00:00
parent 5bc4f51c4b
commit 666309340a
6 changed files with 60 additions and 27 deletions
+25 -3
View File
@@ -56,7 +56,7 @@ public class PdePreferences extends JComponent {
// what to call the feller
static final String PREFS_FILE = "Processing Preferences.txt";
static final String PREFS_FILE = "preferences.txt";
// prompt text stuff
@@ -143,8 +143,10 @@ public class PdePreferences extends JComponent {
// next load user preferences file
File home = new File(System.getProperty("user.home"));
preferencesFile = new File(home, PREFS_FILE);
//File home = new File(System.getProperty("user.home"));
//File processingHome = new File(home, "Processing");
//preferencesFile = new File(home, PREFS_FILE);
preferencesFile = new File(getProcessingHome(), PREFS_FILE);
if (!preferencesFile.exists()) {
// create a new preferences file if none exists
@@ -512,6 +514,26 @@ public class PdePreferences extends JComponent {
// .................................................................
static public File getProcessingHome() {
File home = new File(System.getProperty("user.home"));
if (PdeBase.platform == PdeBase.MACOSX) {
// on macosx put the sketchbook in the "Documents" folder
return new File(home, "Documents" + File.separator + "Processing");
} else if (PdeBase.platform == PdeBase.WINDOWS) {
// on windows put the sketchbook in the "My Documents" folder
return new File(home, "My Documents" + File.separator + "Processing");
}
// all others, just say home directory
return new File(home, "processing");
}
// .................................................................
// all the information from preferences.txt
//static public String get(String attribute) {
+5 -1
View File
@@ -262,7 +262,11 @@ public class PdePreprocessor {
if (programType == STATIC) {
// now that size() and background() can go inside of draw()
out.print("public void draw() {");
// actually, use setup(), because when running externally
// the applet size needs to be set before the window is drawn,
// meaning that after setup() things need to be ducky.
//out.print("public void draw() {");
out.print("public void setup() {");
}
}
}
+5 -1
View File
@@ -88,7 +88,6 @@ public class PdeRuntime implements PdeMessageConsumer {
windowLocation.x + "," + windowLocation.y) :
(PApplet.EXT_LOCATION + x1 + "," + y1);
//java "-Djava.library.path=C:\Documents and Settings\fry\My Documents\sketchbook\image_loading_problems\code" -cp "lib\build;java\lib\rt.jar;lib;lib\build;lib\pde.jar;lib\core.jar;lib\mrj.jar;lib\antlr.jar;lib\oro.jar;C:\WINDOWS\system32\QTJava.zip;;C:\Documents and Settings\fry\My Documents\sketchbook\image_loading_problems\code" processing.core.PApplet --location=710,61 "--sketch-folder=C:\Documents and Settings\fry\My Documents\sketchbook\image_loading_problems" Temporary_6879_7583
String command[] = new String[] {
"java",
"-Djava.library.path=" + sketch.libraryPath, // might be ""
@@ -130,6 +129,10 @@ public class PdeRuntime implements PdeMessageConsumer {
}
applet.start();
/*
// appears to be no longer necessary now that draw()
// is gonna be run inside of setup()
// check to see if it's a draw mode applet
boolean drawMode = false;
try {
@@ -152,6 +155,7 @@ public class PdeRuntime implements PdeMessageConsumer {
} catch (InterruptedException e) { }
}
}
*/
if (editor.presenting) {
//window = new Window(new Frame());
+4
View File
@@ -74,6 +74,8 @@ public class PdeSketchbook {
if (PdePreferences.get("sketchbook.path") == null) {
// by default, set default sketchbook path to the user's
// home folder with 'sketchbook' as a subdirectory of that
/*
File home = new File(System.getProperty("user.home"));
if (PdeBase.platform == PdeBase.MACOSX) {
@@ -84,6 +86,8 @@ public class PdeSketchbook {
// on windows put the sketchbook in the "My Documents" folder
home = new File(home, "My Documents");
}
*/
File home = PdePreferences.getProcessingHome();
String folderName = PdePreferences.get("sketchbook.name.default");
//System.out.println("home = " + home);