Add support for creating a directory

This commit is contained in:
Kevin Sawicki
2012-06-11 15:55:53 -07:00
parent 6ac99c458c
commit b768d55dd2
2 changed files with 13 additions and 0 deletions

View File

@@ -203,6 +203,13 @@ void NativeHandler::AsyncList(const CefString& name,
free (paths);
}
void NativeHandler::MakeDirectory(const CefString& name,
CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval, CefString& exception) {
string content = arguments[0]->GetStringValue().ToString();
mkdir(content.c_str(), S_IRWXU);
}
bool NativeHandler::Execute(const CefString& name, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
CefString& exception) {
@@ -232,6 +239,8 @@ bool NativeHandler::Execute(const CefString& name, CefRefPtr<CefV8Value> object,
ReadFromPasteboard(name, object, arguments, retval, exception);
else if (name == "asyncList")
AsyncList(name, object, arguments, retval, exception);
else if (name == "makeDirectory")
MakeDirectory(name, object, arguments, retval, exception);
else
cout << "Unhandled -> " + name.ToString() << " : "
<< arguments[0]->GetStringValue().ToString() << endl;

View File

@@ -70,6 +70,10 @@ private:
void ReadFromPasteboard(const CefString& name, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
CefString& exception);
void MakeDirectory(const CefString& name, CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
CefString& exception);
};
#endif