Remove $native.exists()

This commit is contained in:
Kevin Sawicki
2013-03-07 17:57:28 -08:00
parent 4bc513a8e3
commit fedf43ca0a
2 changed files with 5 additions and 13 deletions

View File

@@ -24,7 +24,7 @@ namespace v8_extensions {
void Native::CreateContextBinding(CefRefPtr<CefV8Context> context) {
const char* methodNames[] = {
"exists", "read", "write", "absolute",
"read", "write", "absolute",
"remove", "writeToPasteboard", "readFromPasteboard", "quit", "watchPath", "unwatchPath",
"getWatchedPaths", "unwatchAllPaths", "makeDirectory", "move", "moveToTrash", "reload", "lastModified",
"md5ForPath", "getPlatform", "setWindowState", "getWindowState", "isMisspelled",
@@ -49,14 +49,7 @@ namespace v8_extensions {
CefRefPtr<CefV8Value>& retval,
CefString& exception) {
@autoreleasepool {
if (name == "exists") {
std::string cc_value = arguments[0]->GetStringValue().ToString();
const char *path = cc_value.c_str();
retval = CefV8Value::CreateBool(access(path, F_OK) == 0);
return true;
}
else if (name == "read") {
if (name == "read") {
NSString *path = stringFromCefV8Value(arguments[0]);
NSError *error = nil;

View File

@@ -27,8 +27,7 @@ module.exports =
# Returns true if the file specified by path exists
exists: (path) ->
return false unless path?
$native.exists(path)
path? and nodeFs.existsSync(path)
# Returns the extension of a file. The extension of a file is the
# last dot (excluding any number of initial dots) followed by one or
@@ -50,12 +49,12 @@ module.exports =
# Returns true if the file specified by path exists and is a
# directory.
isDirectory: (path) ->
path? and nodeFs.existsSync(path) and nodeFs.statSync(path).isDirectory()
@exists(path) and nodeFs.statSync(path).isDirectory()
# Returns true if the file specified by path exists and is a
# regular file.
isFile: (path) ->
path? and nodeFs.existsSync(path) and nodeFs.statSync(path).isFile()
@exists(path) and nodeFs.statSync(path).isFile()
# Returns an array with all the names of files contained
# in the directory path.