Changeset 7058 in josm for trunk


Ignore:
Timestamp:
2014-05-04T13:01:26+02:00 (10 years ago)
Author:
stoecker
Message:

support josmdir:// URI

File:
1 edited

Legend:

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

    r7033 r7058  
    4444     *  <li>{@code file:///SOME/FILE} the same as above</li>
    4545     *  <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li>
     46     *  <li>{@code josmdir://SOME/FILE} file inside josm config directory (since r7058)</li>
    4647     *  <li>{@code http://...} a URL. It will be cached on disk.</li></ul>
    4748     * @throws IOException when the resource with the given name could not be retrieved
     
    5859     *  <li>{@code file:///SOME/FILE} the same as above</li>
    5960     *  <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li>
     61     *  <li>{@code josmdir://SOME/FILE} file inside josm config directory (since r7058)</li>
    6062     *  <li>{@code http://...} a URL. It will be cached on disk.</li></ul>
    6163     * @param maxTime the maximum age of the cache file (in seconds)
     
    7375     *  <li>{@code file:///SOME/FILE} the same as above</li>
    7476     *  <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li>
     77     *  <li>{@code josmdir://SOME/FILE} file inside josm config directory (since r7058)</li>
    7578     *  <li>{@code http://...} a URL. It will be cached on disk.</li></ul>
    7679     * @param destDir the destination directory for the cache file. Only applies for URLs.
     
    8891     *  <li>{@code file:///SOME/FILE} the same as above</li>
    8992     *  <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li>
     93     *  <li>{@code josmdir://SOME/FILE} file inside josm config directory (since r7058)</li>
    9094     *  <li>{@code http://...} a URL. It will be cached on disk.</li></ul>
    9195     * @param destDir the destination directory for the cache file. Only applies for URLs.
     
    104108     *  <li>{@code file:///SOME/FILE} the same as above</li>
    105109     *  <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li>
     110     *  <li>{@code josmdir://SOME/FILE} file inside josm config directory (since r7058)</li>
    106111     *  <li>{@code http://...} a URL. It will be cached on disk.</li></ul>
    107112     * @param destDir the destination directory for the cache file. Only applies for URLs.
     
    121126     *  <li>{@code file:///SOME/FILE} the same as above</li>
    122127     *  <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li>
     128     *  <li>{@code josmdir://SOME/FILE} file inside josm config directory (since r7058)</li>
    123129     *  <li>{@code http://...} a URL. It will be cached on disk.</li></ul>
    124130     * @param destDir the destination directory for the cache file. Only applies for URLs.
     
    147153                    throw new IOException(tr("Failed to open input stream for resource ''{0}''", name));
    148154                return;
    149             }
    150             file = new File(name);
     155            } else if (name.startsWith("josmdir://")) {
     156                file = new File(Main.pref.getPreferencesDir(), name.substring("josmdir://".length()));
     157            } else {
     158                file = new File(name);
     159            }
    151160        }
    152161        if (file == null)
Note: See TracChangeset for help on using the changeset viewer.