Permalink
Browse files

Windows implementation of MakeDir and Rename.

  • Loading branch information...
1 parent 2288210 commit a119b6bcd34814c54a84ab495ee8d075ffd34567 @gruehle gruehle committed Sep 26, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 appshell/appshell_extensions_win.cpp
@@ -554,6 +554,22 @@ int32 ReadDir(ExtensionString path, CefRefPtr<CefListValue>& directoryContents)
return NO_ERROR;
}
+int32 MakeDir(ExtensionString path, int32 mode)
+{
+ if (!CreateDirectory(path.c_str(), NULL))
+ return ConvertWinErrorCode(GetLastError(), false);
+
+ return NO_ERROR;
+}
+
+int32 Rename(ExtensionString oldName, ExtensionString newName)
+{
+ if (!MoveFile(oldName.c_str(), newName.c_str()))
+ return ConvertWinErrorCode(GetLastError());
+
+ return NO_ERROR;
+}
+
int32 GetFileModificationTime(ExtensionString filename, uint32& modtime, bool& isDir)
{
DWORD dwAttr = GetFileAttributes(filename.c_str());
@@ -740,6 +756,8 @@ int ConvertWinErrorCode(int errorCode, bool isReading)
return ERR_CANT_WRITE;
case ERROR_HANDLE_DISK_FULL:
return ERR_OUT_OF_SPACE;
+ case ERROR_ALREADY_EXISTS:
+ return ERR_FILE_EXISTS;
default:
return ERR_UNKNOWN;
}

0 comments on commit a119b6b

Please sign in to comment.