diff --git a/native/v8_extensions/native.mm b/native/v8_extensions/native.mm index ee8ef0112..4fdd43888 100644 --- a/native/v8_extensions/native.mm +++ b/native/v8_extensions/native.mm @@ -23,7 +23,7 @@ namespace v8_extensions { void Native::CreateContextBinding(CefRefPtr context) { const char* methodNames[] = { - "absolute", "writeToPasteboard", "readFromPasteboard", "quit", + "writeToPasteboard", "readFromPasteboard", "quit", "watchPath", "unwatchPath", "getWatchedPaths", "unwatchAllPaths", "moveToTrash", "reload", "getPlatform", "setWindowState", "getWindowState", "isMisspelled", "getCorrectionsForMisspelling" @@ -47,17 +47,7 @@ namespace v8_extensions { CefRefPtr& retval, CefString& exception) { @autoreleasepool { - if (name == "absolute") { - NSString *path = stringFromCefV8Value(arguments[0]); - - path = [path stringByStandardizingPath]; - if ([path characterAtIndex:0] == '/') { - retval = CefV8Value::CreateString([path UTF8String]); - } - - return true; - } - else if (name == "writeToPasteboard") { + if (name == "writeToPasteboard") { NSString *text = stringFromCefV8Value(arguments[0]); NSPasteboard *pb = [NSPasteboard generalPasteboard]; diff --git a/src/stdlib/fs-utils.coffee b/src/stdlib/fs-utils.coffee index 1b3d8a46f..ad1260e83 100644 --- a/src/stdlib/fs-utils.coffee +++ b/src/stdlib/fs-utils.coffee @@ -10,7 +10,21 @@ module.exports = # Make the given path absolute by resolving it against the # current working directory. absolute: (path) -> - $native.absolute(path) + return null unless path? + + if path.indexOf('~/') is 0 + if process.platform is 'win32' + home = process.env.USERPROFILE + else + home = process.env.HOME + path = "#{home}#{path.substring(1)}" + try + path = fs.realpathSync(path) + if process.platform is 'darwin' and path.indexOf('/private/') is 0 + path = path.substring(8) + path + catch e + path # Return the basename of the given path. That is the path with # any leading directory components removed. If specified, also