* make sure {home} works correctly in the sandbox

This commit is contained in:
Reinhard Pointner 2014-10-27 19:09:52 +00:00
parent 2bb430b9c3
commit 92482a80e2
2 changed files with 14 additions and 1 deletions

View File

@ -136,6 +136,19 @@ public final class Settings {
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) {
return new Settings(Preferences.userNodeForPackage(type));
}

View File

@ -722,7 +722,7 @@ public class MediaBindingBean {
@Define("home")
public File getUserHome() throws IOException {
return new File(System.getProperty("user.home"));
return Settings.getRealUserHome();
}
@Define("now")