mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Remove $native.exists()
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user