diff options
author | David Corrales | 2007-06-04 03:46:56 +0000 |
---|---|---|
committer | David Corrales | 2007-06-04 03:46:56 +0000 |
commit | 3e7c5b027e2131cde30d994ccdb27c77f0118ffe (patch) | |
tree | b0858f0a62292098230521df75fbae6fcbcc3e9f /backends/fs/windows | |
parent | 0cab5b7791e56b32455748bf20c21f0d6b42f654 (diff) | |
download | scummvm-rg350-3e7c5b027e2131cde30d994ccdb27c77f0118ffe.tar.gz scummvm-rg350-3e7c5b027e2131cde30d994ccdb27c77f0118ffe.tar.bz2 scummvm-rg350-3e7c5b027e2131cde30d994ccdb27c77f0118ffe.zip |
Added a missing include in non-POSIX factories.
For the POSIX and Windows architectures, added exists(), isReadable() and isWritable()
svn-id: r27073
Diffstat (limited to 'backends/fs/windows')
-rw-r--r-- | backends/fs/windows/windows-fs-factory.h | 1 | ||||
-rw-r--r-- | backends/fs/windows/windows-fs.cpp | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/backends/fs/windows/windows-fs-factory.h b/backends/fs/windows/windows-fs-factory.h index b260eab65a..7d17802b52 100644 --- a/backends/fs/windows/windows-fs-factory.h +++ b/backends/fs/windows/windows-fs-factory.h @@ -1,6 +1,7 @@ #ifndef WINDOWS_FILESYSTEM_FACTORY_H #define WINDOWS_FILESYSTEM_FACTORY_H +#include "common/singleton.h" #include "backends/fs/abstract-fs-factory.h" /** diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index 88d04e1643..9cd6aa40a0 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -29,6 +29,7 @@ #endif #include "common/stdafx.h" #include "backends/fs/abstract-fs.h" +#include <io.h> #include <stdio.h> #include <stdlib.h> #ifndef _WIN32_WCE @@ -70,11 +71,14 @@ public: * @param currentDir if true, the path parameter will be ignored and the resulting node will point to the current directory. */ WindowsFilesystemNode(const String &path, const bool currentDir); - + + virtual bool exists() const { return _access(_path.c_str(), F_OK) == 0; } virtual String getDisplayName() const { return _displayName; } virtual String getName() const { return _displayName; } virtual String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; } + virtual bool isReadable() const { return _access(_path.c_str(), R_OK) == 0; } + virtual bool isWritable() const { return _access(_path.c_str(), W_OK) == 0; } virtual bool isValid() const { return _isValid; } virtual AbstractFilesystemNode *getChild(const String &n) const; @@ -217,11 +221,11 @@ WindowsFilesystemNode::WindowsFilesystemNode(const String &p, const bool current DWORD fileAttribs = GetFileAttributes(toUnicode(_path.c_str())); if (fileAttribs == INVALID_FILE_ATTRIBUTES) { - _isValid = false; _isDirectory = false; + _isValid = false; } else { - _isValid = true; _isDirectory = ((fileAttribs & FILE_ATTRIBUTE_DIRECTORY) != 0); + _isValid = true; } _isPseudoRoot = false; } @@ -276,9 +280,12 @@ bool WindowsFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode) c sprintf(searchPath, "%s*", _path.c_str()); handle = FindFirstFile(toUnicode(searchPath), &desc); + if (handle == INVALID_HANDLE_VALUE) return false; + addFile(myList, mode, _path.c_str(), &desc); + while (FindNextFile(handle, &desc)) addFile(myList, mode, _path.c_str(), &desc); |