fs.isFile(path) returns false if given path does not exist

This commit is contained in:
Corey Johnson
2012-05-08 10:18:17 -07:00
parent b528196d1b
commit 545671a641
3 changed files with 24 additions and 1 deletions

View File

@@ -127,6 +127,15 @@ bool NativeHandler::Execute(const CefString& name,
return true;
}
else if (name == "isFile") {
NSString *path = stringFromCefV8Value(arguments[0]);
BOOL isDir = false;
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDir];
retval = CefV8Value::CreateBool(exists && !isDir);
return true;
}
else if (name == "remove") {
NSString *path = stringFromCefV8Value(arguments[0]);