Skip to content

Commit

Permalink
Workaround NSHomeDirectory() is returning a path inside the sandbox c…
Browse files Browse the repository at this point in the history
…ontainer.

Former-commit-id: 4b5d117a687a2dd97f9ef7c3fea84cdc0217f850
  • Loading branch information
dkocher committed May 6, 2013
1 parent 0257120 commit bc2aa3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions source/ch/cyberduck/core/Preferences.java
Expand Up @@ -213,6 +213,7 @@ protected void setDefaults() {
defaults.put("path.normalize", String.valueOf(true));
defaults.put("path.normalize.unicode", String.valueOf(false));

defaults.put("local.user.home", System.getProperty("user.home"));
defaults.put("local.symboliclink.resolve", String.valueOf(false));
defaults.put("local.normalize.unicode", String.valueOf(true));
defaults.put("local.list.native", String.valueOf(true));
Expand Down
13 changes: 9 additions & 4 deletions source/ch/cyberduck/core/local/FinderLocal.java
Expand Up @@ -31,7 +31,6 @@
import ch.cyberduck.ui.cocoa.foundation.NSFileManager;
import ch.cyberduck.ui.cocoa.foundation.NSNumber;
import ch.cyberduck.ui.cocoa.foundation.NSObject;
import ch.cyberduck.ui.cocoa.foundation.NSString;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
Expand Down Expand Up @@ -269,10 +268,16 @@ public int hashCode() {
}

private static String stringByAbbreviatingWithTildeInPath(final String path) {
return NSString.stringByAbbreviatingWithTildeInPath(path);
if(StringUtils.startsWith(path, Preferences.instance().getProperty("local.user.home"))) {
return "~" + StringUtils.removeStart(path, Preferences.instance().getProperty("local.user.home"));
}
return path;
}

private static String stringByExpandingTildeInPath(final String path) {
return NSString.stringByExpandingTildeInPath(path);
if(path.startsWith("~")) {
return Preferences.instance().getProperty("local.user.home") + StringUtils.substring(path, 1);
}
return path;
}
}
}

0 comments on commit bc2aa3e

Please sign in to comment.