diff --git a/org/lateralgm/main/LGM.java b/org/lateralgm/main/LGM.java index 037e599e..6313b310 100644 --- a/org/lateralgm/main/LGM.java +++ b/org/lateralgm/main/LGM.java @@ -131,7 +131,7 @@ public final class LGM { - public static final String version = "1.8.225"; //$NON-NLS-1$ + public static final String version = "1.8.226"; //$NON-NLS-1$ // TODO: This list holds the class loader for any loaded plugins which should be // cleaned up and closed when the application closes. @@ -1217,6 +1217,9 @@ public static void main(final String[] args) if (javaVersion < 10700) System.out.println("Some program functionality will be limited due to your outdated Java version"); //$NON-NLS-1$ + // Fix up raw filepaths from 1.5.7.1 into file URI format. + PrefsStore.patchRecentFiles(); + // Create the main window on the EDT for safety. // https://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html SwingUtilities.invokeLater(new Runnable() diff --git a/org/lateralgm/main/PrefsStore.java b/org/lateralgm/main/PrefsStore.java index 5e85499c..17ae8d67 100644 --- a/org/lateralgm/main/PrefsStore.java +++ b/org/lateralgm/main/PrefsStore.java @@ -10,6 +10,7 @@ package org.lateralgm.main; import java.awt.Rectangle; +import java.io.File; import java.util.ArrayList; import java.util.Locale; import java.util.prefs.BackingStoreException; @@ -52,7 +53,6 @@ public static ArrayList getRecentFiles() for (String name : array) list.add(Util.urlDecode(name)); return list; - } public static void addRecentFile(String name) @@ -67,6 +67,28 @@ public static void addRecentFile(String name) PREFS.put("FILE_RECENT",newList); } + /** + * Updates raw filepaths from 1.5.7.1 to proper URI format. + */ + public static void patchRecentFiles() + { + String value = PREFS.get("FILE_RECENT",null); + if (value == null) return; + String[] array = value.split(" "); + if (array.length < 1) return; + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < array.length; ++i) + { + if (i > 0) sb.append(" "); + String str = array[i]; + if (!str.startsWith("file%3A%2F")) + sb.append(Util.urlEncode(new File(Util.urlDecode(str)).toURI().toString())); + else + sb.append(str); + } + PREFS.put("FILE_RECENT",sb.toString()); + } + public static Rectangle getWindowBounds(Rectangle def) { return Util.stringToRectangle(PREFS.get("WINDOW_BOUNDS",null),def);