mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add support for creating a directory
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user