()
| 2239 | |
| 2240 | |
| 2241 | static public void locateSketchbookFolder() { |
| 2242 | // If a value is at least set, first check to see if the folder exists. |
| 2243 | // If it doesn't, warn the user that the sketchbook folder is being reset. |
| 2244 | String sketchbookPath = Preferences.getSketchbookPath(); |
| 2245 | if (sketchbookPath != null) { |
| 2246 | sketchbookFolder = new File(sketchbookPath); |
| 2247 | if (!sketchbookFolder.exists()) { |
| 2248 | Messages.showWarning("Sketchbook folder disappeared",""" |
| 2249 | The sketchbook folder no longer exists. |
| 2250 | Processing will switch to the default sketchbook |
| 2251 | location, and create a new sketchbook folder if |
| 2252 | necessary. Processing will then stop talking |
| 2253 | about itself in the third person.""", null); |
| 2254 | sketchbookFolder = null; |
| 2255 | } |
| 2256 | } |
| 2257 | |
| 2258 | // If no path is set, get the default sketchbook folder for this platform |
| 2259 | if (sketchbookFolder == null) { |
| 2260 | sketchbookFolder = getDefaultSketchbookFolder(); |
| 2261 | Preferences.setSketchbookPath(sketchbookFolder.getAbsolutePath()); |
| 2262 | if (!sketchbookFolder.exists()) { |
| 2263 | if (!sketchbookFolder.mkdirs()) { |
| 2264 | Messages.showError("Could not create sketchbook", |
| 2265 | "Unable to create a sketchbook folder at\n" + |
| 2266 | sketchbookFolder + "\n" + |
| 2267 | "Try creating a folder at that path and restart Processing.", null); |
| 2268 | } |
| 2269 | } |
| 2270 | } |
| 2271 | |
| 2272 | // make sure the libraries/modes/tools directories exist |
| 2273 | makeSketchbookSubfolders(); |
| 2274 | } |
| 2275 | |
| 2276 | |
| 2277 | public void setSketchbookFolder(File folder) { |
no test coverage detected