| 1 | Index: src/org/openstreetmap/josm/plugins/PluginDownloader.java
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- src/org/openstreetmap/josm/plugins/PluginDownloader.java (Revision 1014)
|
|---|
| 4 | +++ src/org/openstreetmap/josm/plugins/PluginDownloader.java (Arbeitskopie)
|
|---|
| 5 | @@ -172,7 +172,7 @@
|
|---|
| 6 | public static boolean moveUpdatedPlugins() {
|
|---|
| 7 | File pluginDir = Main.pref.getPluginsDirFile();
|
|---|
| 8 | boolean ok = true;
|
|---|
| 9 | - if (pluginDir.exists() && pluginDir.isDirectory()) {
|
|---|
| 10 | + if (pluginDir.exists() && pluginDir.isDirectory() && pluginDir.canWrite()) {
|
|---|
| 11 | final File[] files = pluginDir.listFiles(new FilenameFilter() {
|
|---|
| 12 | public boolean accept(File dir, String name) {
|
|---|
| 13 | return name.endsWith(".new");
|
|---|
| 14 | @@ -180,7 +180,7 @@
|
|---|
| 15 | for (File updatedPlugin : files) {
|
|---|
| 16 | final String filePath = updatedPlugin.getPath();
|
|---|
| 17 | File plugin = new File(filePath.substring(0, filePath.length() - 4));
|
|---|
| 18 | - ok = plugin.delete() && updatedPlugin.renameTo(plugin) && ok;
|
|---|
| 19 | + ok = (plugin.delete() || !plugin.exists()) && updatedPlugin.renameTo(plugin) && ok;
|
|---|
| 20 | }
|
|---|
| 21 | }
|
|---|
| 22 | return ok;
|
|---|