_wfopen -> xe::filesystem::OpenFile.

Progress on #305.
This commit is contained in:
Ben Vanik
2015-06-28 17:16:44 -07:00
parent 1d7606097a
commit 1106029afc
9 changed files with 28 additions and 14 deletions

View File

@@ -25,11 +25,11 @@ bool PathExists(const std::wstring& path) {
bool CreateFolder(const std::wstring& path) {
wchar_t folder[MAX_PATH] = {0};
auto end = std::wcschr(path.c_str(), L'\\');
auto end = std::wcschr(path.c_str(), xe::wpath_separator);
while (end) {
wcsncpy(folder, path.c_str(), end - path.c_str() + 1);
CreateDirectory(folder, NULL);
end = wcschr(++end, L'\\');
end = wcschr(++end, xe::wpath_separator);
}
return PathExists(path);
}
@@ -49,6 +49,11 @@ bool IsFolder(const std::wstring& path) {
(attrib & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY;
}
FILE* OpenFile(const std::wstring& path, const char* mode) {
auto fixed_path = xe::fix_path_separators(path);
return _wfopen(fixed_path.c_str(), xe::to_wstring(mode).c_str());
}
#define COMBINE_TIME(t) (((uint64_t)t.dwHighDateTime << 32) | t.dwLowDateTime)
std::vector<FileInfo> ListFiles(const std::wstring& path) {