|
34 | 34 | import processing.app.Base; |
35 | 35 | import processing.app.Messages; |
36 | 36 | import processing.app.Preferences; |
| 37 | +import processing.app.Util; |
37 | 38 | import processing.app.platform.WindowsRegistry.REGISTRY_ROOT_KEY; |
38 | 39 |
|
39 | 40 | import processing.core.PApplet; |
@@ -255,29 +256,43 @@ protected void checkPath() { |
255 | 256 |
|
256 | 257 | // looking for Documents and Settings/blah/Application Data/Processing |
257 | 258 | public File getSettingsFolder() throws Exception { |
258 | | - String appDataRoaming = getAppDataPath(); |
259 | | - if (appDataRoaming != null) { |
260 | | - File settingsFolder = new File(appDataRoaming, APP_NAME); |
261 | | - if (settingsFolder.exists() || settingsFolder.mkdirs()) { |
262 | | - return settingsFolder; |
| 259 | + try { |
| 260 | + String appDataRoaming = getAppDataPath(); |
| 261 | + if (appDataRoaming != null) { |
| 262 | + File settingsFolder = new File(appDataRoaming, APP_NAME); |
| 263 | + if (settingsFolder.exists() || settingsFolder.mkdirs()) { |
| 264 | + return settingsFolder; |
| 265 | + } |
| 266 | + } |
| 267 | + |
| 268 | + String appDataLocal = getLocalAppDataPath(); |
| 269 | + if (appDataLocal != null) { |
| 270 | + File settingsFolder = new File(appDataLocal, APP_NAME); |
| 271 | + if (settingsFolder.exists() || settingsFolder.mkdirs()) { |
| 272 | + return settingsFolder; |
| 273 | + } |
263 | 274 | } |
264 | | - } |
265 | 275 |
|
266 | | - String appDataLocal = getLocalAppDataPath(); |
267 | | - if (appDataLocal != null) { |
268 | | - File settingsFolder = new File(appDataLocal, APP_NAME); |
269 | | - if (settingsFolder.exists() || settingsFolder.mkdirs()) { |
270 | | - return settingsFolder; |
| 276 | + if (appDataRoaming == null && appDataLocal == null) { |
| 277 | + throw new IOException("Could not get the AppData folder"); |
271 | 278 | } |
272 | | - } |
273 | 279 |
|
274 | | - if (appDataRoaming == null && appDataLocal == null) { |
275 | | - throw new IOException("Could not get the AppData folder"); |
| 280 | + // https://github.com/processing/processing/issues/3838 |
| 281 | + throw new IOException("Permissions error: make sure that " + |
| 282 | + appDataRoaming + " or " + appDataLocal + |
| 283 | + " is writable."); |
| 284 | + |
| 285 | + } catch (UnsatisfiedLinkError ule) { |
| 286 | + String path = new File("lib").getCanonicalPath(); |
| 287 | + |
| 288 | + String msg = Util.hasNonAsciiChars(path) ? |
| 289 | + "Please move Processing to a location with only\n" + |
| 290 | + "ASCII characters in the path and try again.\n" + |
| 291 | + "https://github.com/processing/processing/issues/3543" : |
| 292 | + "Could not find JNA support files, please reinstall Processing."; |
| 293 | + Messages.showError("Windows JNA Problem", msg, ule); |
| 294 | + return null; // unreachable |
276 | 295 | } |
277 | | - |
278 | | - // https://github.com/processing/processing/issues/3838 |
279 | | - throw new IOException("Please fix permissions for either " + |
280 | | - appDataRoaming + " or " + appDataLocal); |
281 | 296 | } |
282 | 297 |
|
283 | 298 |
|
|
0 commit comments