Skip to content

Commit

Permalink
Merge pull request #3110 from XavSPM/master
Browse files Browse the repository at this point in the history
Modification of preference import function for Windows
  • Loading branch information
shroffk authored Aug 16, 2024
2 parents 36d1e2a + 83c779f commit e5cb1b8
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.Properties;
import java.util.prefs.Preferences;

import org.phoebus.framework.workbench.Locations;

/** Load preferences from a property file
* @author Kay Kasemir
*/
Expand Down Expand Up @@ -46,7 +48,16 @@ public static void load(final InputStream stream) throws Exception

final String pack = "/" + prop.substring(0, sep).replace('.', '/');
final String name = prop.substring(sep+1);
final String value = props.getProperty(prop);
String value = props.getProperty(prop);

if (value.contains("$(phoebus.install)"))
value = value.replace("$(phoebus.install)", Locations.install().toString()).replace("\\", "/").replace(" ", "%20");
if (value.contains("$(phoebus.user)"))
value = value.replace("$(phoebus.user)", Locations.user().toString()).replace("\\", "/").replace(" ", "%20");
if (value.contains("$(user.home)"))
value = value.replace("$(user.home)", System.getProperty("user.home").toString()).replace("\\", "/").replace(" ", "%20");


final Preferences prefs = Preferences.userRoot().node(pack);
prefs.put(name, value);
// System.out.println(pack + "/" + name + "=" + value);
Expand Down

0 comments on commit e5cb1b8

Please sign in to comment.