Support --target=path to stfs root.

Fixes #302.
This commit is contained in:
Ben Vanik
2015-06-28 15:28:04 -07:00
parent e05cc3ba37
commit 30e0c6dbb1
3 changed files with 51 additions and 1 deletions

View File

@@ -22,8 +22,8 @@ namespace filesystem {
bool PathExists(const std::wstring& path);
bool CreateFolder(const std::wstring& path);
bool DeleteFolder(const std::wstring& path);
bool IsFolder(const std::wstring& path);
struct FileInfo {
enum class Type {

View File

@@ -43,6 +43,12 @@ bool DeleteFolder(const std::wstring& path) {
return SHFileOperation(&op) == 0;
}
bool IsFolder(const std::wstring& path) {
DWORD attrib = GetFileAttributes(path.c_str());
return attrib != INVALID_FILE_ATTRIBUTES &&
(attrib & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY;
}
#define COMBINE_TIME(t) (((uint64_t)t.dwHighDateTime << 32) | t.dwLowDateTime)
std::vector<FileInfo> ListFiles(const std::wstring& path) {