mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fixing bugs with non-ascii folders on windows
This commit is contained in:
+25
-4
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user