Changeset 11195 in josm for trunk


Ignore:
Timestamp:
2016-10-30T19:25:34+01:00 (3 years ago)
Author:
wiktorn
Message:

Do not remove cache file if the file is local.

Local files accessed through CachedFile are not copied, only a local reference is given. So removing the file means removal of source file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r11009 r11195  
    532532     */
    533533    public void clear() throws IOException {
     534        URL url;
     535        try {
     536            url = new URL(name);
     537            if ("file".equals(url.getProtocol())) {
     538                return; // this is local file - do not delete it
     539            }
     540        } catch (MalformedURLException e) {
     541            return; // if it's not a URL, then it still might be a local file - better not to delete
     542        }
    534543        File f = getFile();
    535544        if (f != null && f.exists()) {
Note: See TracChangeset for help on using the changeset viewer.