problems with ascii in folder names is half fixed, still need to figure

jikes out
This commit is contained in:
benfry
2005-05-20 02:20:00 +00:00
parent 693b07df12
commit c45b98aac0
6 changed files with 57 additions and 10 deletions
+32 -3
View File
@@ -250,7 +250,7 @@ public class Base {
"Software\\Microsoft\\Windows\\CurrentVersion" +
"\\Explorer\\Shell Folders";
RegistryKey localKey = topKey.openSubKey(localKeyPath);
String appDataPath = localKey.getStringValue("AppData");
String appDataPath = cleanKey(localKey.getStringValue("AppData"));
//System.out.println("app data path is " + appDataPath);
//System.exit(0);
//topKey.closeKey(); // necessary?
@@ -278,6 +278,7 @@ public class Base {
if (!result) {
// try the fallback location
System.out.println("Using fallback path for settings.");
String fallback = Preferences.get("settings.path.fallback");
dataFolder = new File(fallback);
if (!dataFolder.exists()) {
@@ -378,10 +379,9 @@ public class Base {
"Software\\Microsoft\\Windows\\CurrentVersion" +
"\\Explorer\\Shell Folders";
RegistryKey localKey = topKey.openSubKey(localKeyPath);
String personalPath = localKey.getStringValue("Personal");
String personalPath = cleanKey(localKey.getStringValue("Personal"));
//topKey.closeKey(); // necessary?
//localKey.closeKey();
sketchbookFolder = new File(personalPath, "Processing");
} catch (Exception e) {
@@ -416,6 +416,7 @@ public class Base {
if (!result) {
// try the fallback location
System.out.println("Using fallback path for sketchbook.");
String fallback = Preferences.get("sketchbook.path.fallback");
sketchbookFolder = new File(fallback);
if (!sketchbookFolder.exists()) {
@@ -433,6 +434,34 @@ public class Base {
}
static public String cleanKey(String what) {
// jnireg seems to be reading the chars as bytes
// so maybe be as simple as & 0xff and then running through decoder
char c[] = what.toCharArray();
// if chars are in the tooHigh range, it's prolly because
// a byte from the jni registry was turned into a char
// and there was a sign extension.
// e.g. 0xFC (252, umlaut u) became 0xFFFC (65532).
// but on a japanese system, maybe this is two-byte and ok?
int tooHigh = 65536 - 128;
for (int i = 0; i < c.length; i++) {
if (c[i] >= tooHigh) c[i] &= 0xff;
/*
if ((c[i] >= 32) && (c[i] < 128)) {
System.out.print(c[i]);
} else {
System.out.print("[" + PApplet.hex(c[i]) + "]");
}
*/
}
//System.out.println();
return new String(c);
}
// .................................................................
+1 -1
View File
@@ -124,7 +124,7 @@ public class Compiler implements MessageConsumer {
command[baseCommand.length + i] =
buildPath + File.separator + preprocNames[i];
}
//PApplet.printarr(command);
//PApplet.println(command);
/*
String command[] = new String[baseCommand.length + sketch.codeCount];
+1 -1
View File
@@ -304,7 +304,7 @@ public class Editor extends JFrame
windowW, windowH);
// this will be invalid as well, so grab the new value
Preferences.setInteger("last.divider.location",
splitPane.getDividerLocation());
splitPane.getDividerLocation());
} else {
setBounds(Preferences.getInteger("last.window.x"),
Preferences.getInteger("last.window.y"),
+19 -4
View File
@@ -89,9 +89,23 @@ public class Sketchbook {
librariesFolder = new File(System.getProperty("user.dir"), "libraries");
librariesPath = librariesFolder.getAbsolutePath();
//String sketchbookPath = Preferences.get("sketchbook.path");
//if (sketchbookPath == null) {
if (Preferences.get("sketchbook.path") == null) {
String sketchbookPath = Preferences.get("sketchbook.path");
// if a value is at least set, first check to see if the
// folder exists. if it doesn't, warn the user that the
// sketchbook folder is being reset.
if (sketchbookPath != null) {
File skechbookFolder = new File(sketchbookPath);
if (!skechbookFolder.exists()) {
Base.showWarning("Sketchbook folder disappeared",
"The sketchbook folder no longer exists,\n" +
"so a new sketchbook will be created in the\n" +
"default location.", null);
sketchbookPath = null;
}
}
if (sketchbookPath == null) {
// by default, set default sketchbook path to the user's
// home folder with 'sketchbook' as a subdirectory of that
@@ -113,9 +127,10 @@ public class Sketchbook {
//String folderName = Preferences.get("sketchbook.name.default");
//File sketchbookFolder = new File(home, folderName);
//System.out.println("resetting sketchbook path");
File sketchbookFolder = Base.getDefaultSketchbookFolder();
Preferences.set("sketchbook.path",
sketchbookFolder.getAbsolutePath());
sketchbookFolder.getAbsolutePath());
if (!sketchbookFolder.exists()) sketchbookFolder.mkdirs();
}
Binary file not shown.
+4 -1
View File
@@ -22,7 +22,9 @@ _ from use in sketches, because users will rarely have the same font
_ if sketchbook folder doesn't exist, default to the old folder
_ people remove their old p5 folder which contained their sketchbook
_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1116080833;start=0
_ why would garbage in an app's "data" folder cause it to be read as a library?
_ don't allow subfolders inside the sketchbook folder
_ once a sketch is found, don't recurse deeper
_ same for libraries, cuz this makes a mess
fixed previously
o runtime exceptions have stopped coming through (on pc only?)
@@ -122,6 +124,7 @@ PDE - Processing Development Environment
PDE / Base
_ settings.path.fallback not being used
_ need to check the mkdirs() to make sure it's not going too deep
_ really important for intl versions that are having trouble
_ or ask for the sketch folder name.. why isn't it?
_ http://processing.org/bugs/show_bug.cgi?id=1