* make sure {home} works correctly in the sandbox
This commit is contained in:
parent
2bb430b9c3
commit
92482a80e2
|
@ -136,6 +136,19 @@ public final class Settings {
|
||||||
return cacheFolder;
|
return cacheFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static File getRealUserHome() {
|
||||||
|
if (isMacSandbox()) {
|
||||||
|
// when running sandboxed applications user.home may point to the application-specific container
|
||||||
|
String username = System.getProperty("user.name");
|
||||||
|
if (username != null && username.length() > 0) {
|
||||||
|
return new File("/Users", username);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// default home
|
||||||
|
return new File(System.getProperty("user.home"));
|
||||||
|
}
|
||||||
|
|
||||||
public static Settings forPackage(Class<?> type) {
|
public static Settings forPackage(Class<?> type) {
|
||||||
return new Settings(Preferences.userNodeForPackage(type));
|
return new Settings(Preferences.userNodeForPackage(type));
|
||||||
}
|
}
|
||||||
|
|
|
@ -722,7 +722,7 @@ public class MediaBindingBean {
|
||||||
|
|
||||||
@Define("home")
|
@Define("home")
|
||||||
public File getUserHome() throws IOException {
|
public File getUserHome() throws IOException {
|
||||||
return new File(System.getProperty("user.home"));
|
return Settings.getRealUserHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Define("now")
|
@Define("now")
|
||||||
|
|
Loading…
Reference in New Issue