Ignore:
Timestamp:
2009-11-30T13:48:36+01:00 (14 years ago)
Author:
stoecker
Message:

fix #4047 - update warning does not disappear

Location:
trunk/src/org/openstreetmap/josm/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloader.java

    r2542 r2554  
    106106    public static int downloadDescription() {
    107107        int count = 0;
     108        LinkedList<String> sitenames = new LinkedList<String>();
    108109        for (String site : getSites()) {
    109             /* TODO: remove old site files (everything except .jar) */
    110110            try {
     111                String filesite = site.replaceAll("%<(.*)>", "");
    111112                /* replace %<x> with empty string or x=plugins (separated with comma) */
    112113                String pl = Main.pref.getCollectionAsString("plugins");
     
    114115                    site = site.replaceAll("%<(.*)>", "$1"+pl);
    115116                else
    116                     site = site.replaceAll("%<(.*)>", "");
     117                    site = filesite;
    117118                BufferedReader r = new BufferedReader(new InputStreamReader(new URL(site).openStream(), "utf-8"));
    118119                new File(Main.pref.getPreferencesDir()+"plugins").mkdir();
     120                String sname = count + "-site-" + filesite.replaceAll("[/:\\\\ <>|]", "_") + ".txt";
     121                sitenames.add(sname);
    119122                BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
    120                         new FileOutputStream(new File(Main.pref.getPluginsDirFile(),
    121                                 count + "-site-" + site.replaceAll("[/:\\\\ <>|]", "_") + ".txt")), "utf-8"));
     123                        new FileOutputStream(new File(Main.pref.getPluginsDirFile(), sname)), "utf-8"));
    122124                for (String line = r.readLine(); line != null; line = r.readLine()) {
    123125                    out.append(line+"\n");
     
    127129                count++;
    128130            } catch (IOException x) {
     131            }
     132        }
     133        /* remove old files */
     134        File[] pluginFiles = Main.pref.getPluginsDirFile().listFiles();
     135        if (pluginFiles != null) {
     136            for (File f : pluginFiles) {
     137                if (!f.isFile())
     138                    continue;
     139                String fname = f.getName();
     140                if(fname.endsWith(".jar"))
     141                {
     142                    for(String s : PluginHandler.oldplugins)
     143                    {
     144                        if(fname.equals(s+".jar"))
     145                        {
     146                            System.out.println(tr("Delete old plugin {0}",fname));
     147                            f.delete();
     148                        }
     149                    }
     150                }
     151                else if(!fname.endsWith(".jar.new") && !sitenames.contains(fname))
     152                {
     153                    System.out.println(tr("Delete old plugin file {0}",fname));
     154                }
    129155            }
    130156        }
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r2542 r2554  
    4242public class PluginHandler {
    4343
     44    public static String [] oldplugins = new String[] {"mappaint", "unglueplugin",
     45                "lang-de", "lang-en_GB", "lang-fr", "lang-it", "lang-pl", "lang-ro",
     46                "lang-ru", "ewmsplugin", "ywms", "tways-0.2", "geotagged", "landsat",
     47                "namefinder", "waypoints", "slippy_map_chooser", "tcx-support", "usertools"};
     48    public static String [] unmaintained = new String[] {"gpsbabelgui", "Intersect_way"};
     49
    4450    /**
    4551     * All installed and loaded plugins (resp. their main classes)
     
    5965            plugins.addAll(Arrays.asList(System.getProperty("josm.plugins").split(",")));
    6066        }
    61 
    62         String [] oldplugins = new String[] {"mappaint", "unglueplugin",
    63                 "lang-de", "lang-en_GB", "lang-fr", "lang-it", "lang-pl", "lang-ro",
    64                 "lang-ru", "ewmsplugin", "ywms", "tways-0.2", "geotagged", "landsat",
    65                 "namefinder", "waypoints", "slippy_map_chooser", "tcx-support", "usertools"};
    66         String [] unmaintained = new String[] {"gpsbabelgui", "Intersect_way"};
    6767
    6868        for (String p : oldplugins) {
Note: See TracChangeset for help on using the changeset viewer.