mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fighting more battles for #3543
This commit is contained in:
Regular → Executable
Regular → Executable
+8
@@ -666,4 +666,12 @@ public class Util {
|
||||
output.close();
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
|
||||
static public final boolean hasNonAsciiChars(String what) {
|
||||
for (char c : what.toCharArray()) {
|
||||
if (c < 32 || c > 127) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+33
-18
@@ -34,6 +34,7 @@ import com.sun.jna.platform.win32.ShlObj;
|
||||
import processing.app.Base;
|
||||
import processing.app.Messages;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.Util;
|
||||
import processing.app.platform.WindowsRegistry.REGISTRY_ROOT_KEY;
|
||||
|
||||
import processing.core.PApplet;
|
||||
@@ -255,29 +256,43 @@ public class WindowsPlatform extends DefaultPlatform {
|
||||
|
||||
// looking for Documents and Settings/blah/Application Data/Processing
|
||||
public File getSettingsFolder() throws Exception {
|
||||
String appDataRoaming = getAppDataPath();
|
||||
if (appDataRoaming != null) {
|
||||
File settingsFolder = new File(appDataRoaming, APP_NAME);
|
||||
if (settingsFolder.exists() || settingsFolder.mkdirs()) {
|
||||
return settingsFolder;
|
||||
try {
|
||||
String appDataRoaming = getAppDataPath();
|
||||
if (appDataRoaming != null) {
|
||||
File settingsFolder = new File(appDataRoaming, APP_NAME);
|
||||
if (settingsFolder.exists() || settingsFolder.mkdirs()) {
|
||||
return settingsFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String appDataLocal = getLocalAppDataPath();
|
||||
if (appDataLocal != null) {
|
||||
File settingsFolder = new File(appDataLocal, APP_NAME);
|
||||
if (settingsFolder.exists() || settingsFolder.mkdirs()) {
|
||||
return settingsFolder;
|
||||
String appDataLocal = getLocalAppDataPath();
|
||||
if (appDataLocal != null) {
|
||||
File settingsFolder = new File(appDataLocal, APP_NAME);
|
||||
if (settingsFolder.exists() || settingsFolder.mkdirs()) {
|
||||
return settingsFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (appDataRoaming == null && appDataLocal == null) {
|
||||
throw new IOException("Could not get the AppData folder");
|
||||
}
|
||||
if (appDataRoaming == null && appDataLocal == null) {
|
||||
throw new IOException("Could not get the AppData folder");
|
||||
}
|
||||
|
||||
// https://github.com/processing/processing/issues/3838
|
||||
throw new IOException("Please fix permissions for either " +
|
||||
appDataRoaming + " or " + appDataLocal);
|
||||
// https://github.com/processing/processing/issues/3838
|
||||
throw new IOException("Permissions error: make sure that " +
|
||||
appDataRoaming + " or " + appDataLocal +
|
||||
" is writable.");
|
||||
|
||||
} catch (UnsatisfiedLinkError ule) {
|
||||
String path = new File("lib").getCanonicalPath();
|
||||
|
||||
String msg = Util.hasNonAsciiChars(path) ?
|
||||
"Please move Processing to a location with only\n" +
|
||||
"ASCII characters in the path and try again.\n" +
|
||||
"https://github.com/processing/processing/issues/3543" :
|
||||
"Could not find JNA support files, please reinstall Processing.";
|
||||
Messages.showError("Windows JNA Problem", msg, ule);
|
||||
return null; // unreachable
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Regular → Executable
+2
-9
@@ -72,6 +72,7 @@ import processing.app.Language;
|
||||
import processing.app.Messages;
|
||||
import processing.app.Platform;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.Util;
|
||||
|
||||
|
||||
/**
|
||||
@@ -990,7 +991,7 @@ public class Toolkit {
|
||||
// This gets the JAVA_HOME for the *local* copy of the JRE installed with
|
||||
// Processing. If it's not using the local JRE, it may be because of this
|
||||
// launch4j bug: https://github.com/processing/processing/issues/3543
|
||||
if (hasNonAsciiChars(Platform.getJavaHome().getAbsolutePath())) {
|
||||
if (Util.hasNonAsciiChars(Platform.getJavaHome().getAbsolutePath())) {
|
||||
msg += "Trying moving Processing\n" +
|
||||
"to a location with only ASCII characters in the path.";
|
||||
} else {
|
||||
@@ -1006,14 +1007,6 @@ public class Toolkit {
|
||||
}
|
||||
|
||||
|
||||
static private final boolean hasNonAsciiChars(String what) {
|
||||
for (char c : what.toCharArray()) {
|
||||
if (c < 32 || c > 127) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Synthesized replacement for FontMetrics.getAscent(), which is dreadfully
|
||||
* inaccurate and inconsistent across platforms.
|
||||
|
||||
Reference in New Issue
Block a user