fixing bugs with non-ascii folders on windows

This commit is contained in:
benfry
2005-05-20 04:47:21 +00:00
parent c45b98aac0
commit 16ece5364c
3 changed files with 30 additions and 5 deletions
+25 -4
View File
@@ -178,7 +178,7 @@ public class Base {
static final short kUserDomain = -32763;
static public File getProcessingDataFolder() {
static public File getSettingsFolder() {
File dataFolder = null;
String pref = Preferences.get("settings.path");
@@ -296,18 +296,39 @@ public class Base {
}
static public File getProcessingDataFile(String filename) {
return new File(getProcessingDataFolder(), filename);
static public File getSettingsFile(String filename) {
return new File(getSettingsFolder(), filename);
}
static public File getBuildFolder() {
File folder = new File(getProcessingDataFolder(), "build");
String buildPath = Preferences.get("build.path");
if (buildPath != null) return new File(buildPath);
File folder = new File(getTempFolder(), "build");
if (!folder.exists()) folder.mkdirs();
return folder;
}
/**
* Get the path to the platform's temporary folder, by creating
* a temporary temporary file and getting its parent folder.
*/
static public File getTempFolder() {
try {
File ignored = File.createTempFile("ignored", null);
String tempPath = ignored.getParent();
ignored.delete();
return new File(tempPath);
} catch (Exception e) {
e.printStackTrace();
}
return null; // TODO could we *really* ever reach this?
}
/*
static public void addBuildFolderToClassPath() {
String path = getBuildFolder().getAbsolutePath();
+1 -1
View File
@@ -154,7 +154,7 @@ public class Preferences extends JComponent {
//File home = new File(System.getProperty("user.home"));
//File processingHome = new File(home, "Processing");
//preferencesFile = new File(home, PREFS_FILE);
preferencesFile = Base.getProcessingDataFile(PREFS_FILE);
preferencesFile = Base.getSettingsFile(PREFS_FILE);
if (!preferencesFile.exists()) {
// create a new preferences file if none exists
+4
View File
@@ -40,6 +40,10 @@ sketchbook.path.fallback=sketchbook
#settings.path=data
settings.path.fallback=data
# temporary build path, normally this goes into the default
# "temp" folder for that platform (as defined by java)
# but this can be used to set a specific file in case of problems
#build.path=build
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!