Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Windows implementation of MakeDir and Rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
gruehle committed Sep 26, 2012
1 parent abbf0e2 commit 39a560a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions appshell/appshell_extensions_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 39a560a

Please sign in to comment.