Changeset 9645 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-01-27T02:01:55+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r9246 r9645 166 166 File pathDir = new File(getValidatorDir()); 167 167 if (!pathDir.exists()) { 168 pathDir.mkdirs();168 Utils.mkDirs(pathDir); 169 169 } 170 170 } catch (Exception e) { -
trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java
r9309 r9645 96 96 File newDir = file.getParentFile(); 97 97 if (!newDir.exists()) { 98 newDir.mkdirs();98 Utils.mkDirs(newDir); 99 99 } 100 100 } … … 184 184 File newFile = new File(dir, ze.getName()); 185 185 if (ze.isDirectory()) { 186 newFile.mkdirs();186 Utils.mkDirs(newFile); 187 187 } else try (InputStream is = zf.getInputStream(ze)) { 188 188 Files.copy(is, newFile.toPath(), StandardCopyOption.REPLACE_EXISTING); -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r9545 r9645 427 427 File destDirFile = new File(destDir); 428 428 if (!destDirFile.exists()) { 429 destDirFile.mkdirs();429 Utils.mkDirs(destDirFile); 430 430 } 431 431 -
trunk/src/org/openstreetmap/josm/plugins/Plugin.java
r9280 r9645 118 118 File pluginDir = new File(pluginDirName); 119 119 if (!pluginDir.exists()) { 120 pluginDir.mkdirs();120 Utils.mkDirs(pluginDir); 121 121 } 122 122 try (InputStream in = getClass().getResourceAsStream(from)) { -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r9296 r9645 364 364 if (!newPref.exists()) { 365 365 try { 366 Main.pref.getPreferencesDirectory().mkdirs();366 Utils.mkDirs(Main.pref.getPreferencesDirectory()); 367 367 Main.info("Copying old preferences file to new location"); 368 368 Utils.copyFile(oldPref, newPref); -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r9477 r9645 460 460 * Deletes a file and log a default warning if the deletion fails. 461 461 * @param file file to delete 462 * and must contain a single parameter <code>{0}</code> for the file path463 462 * @return {@code true} if and only if the file is successfully deleted; {@code false} otherwise 464 463 * @since 9296 … … 480 479 if (!result) { 481 480 Main.warn(tr(warnMsg, file.getPath())); 481 } 482 return result; 483 } 484 485 /** 486 * Creates a directory and log a default warning if the creation fails. 487 * @param dir directory to create 488 * @return {@code true} if and only if the directory is successfully created; {@code false} otherwise 489 * @since 9645 490 */ 491 public static boolean mkDirs(File dir) { 492 return mkDirs(dir, marktr("Unable to create directory {0}")); 493 } 494 495 /** 496 * Creates a directory and log a configurable warning if the creation fails. 497 * @param dir directory to create 498 * @param warnMsg warning message. It will be translated with {@code tr()} 499 * and must contain a single parameter <code>{0}</code> for the directory path 500 * @return {@code true} if and only if the directory is successfully created; {@code false} otherwise 501 * @since 9645 502 */ 503 public static boolean mkDirs(File dir, String warnMsg) { 504 boolean result = dir.mkdirs(); 505 if (!result) { 506 Main.warn(tr(warnMsg, dir.getPath())); 482 507 } 483 508 return result;
Note:
See TracChangeset
for help on using the changeset viewer.