ScummVM API documentation
libretro-fs.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef LIBRETRO_FILESYSTEM_H
23 #define LIBRETRO_FILESYSTEM_H
24 
25 #include "backends/fs/abstract-fs.h"
26 
27 #ifdef MACOSX
28 #include <sys/types.h>
29 #endif
30 #include <unistd.h>
31 
38 protected:
39  Common::String _displayName;
40  Common::String _path;
41  bool _isDirectory;
42  bool _isValid;
43  bool _isReadable;
44  bool _isWritable;
45 
46  virtual AbstractFSNode *makeNode(const Common::String &path) const {
47  return new LibRetroFilesystemNode(path);
48  }
49 
53  LibRetroFilesystemNode() : _isDirectory(false), _isValid(false) {}
54 
55 public:
62 
63  virtual bool exists() const {
64  return access(_path.c_str(), F_OK) == 0;
65  }
67  return _displayName;
68  }
69  virtual Common::String getName() const {
70  return _displayName;
71  }
72  virtual Common::String getPath() const {
73  return _path;
74  }
75  virtual bool isDirectory() const {
76  return _isDirectory && _isReadable;
77  }
78  virtual bool isReadable() const {
79  return _isReadable;
80  }
81  virtual bool isWritable() const {
82  return _isWritable;
83  }
84 
85  virtual AbstractFSNode *getChild(const Common::String &n) const;
86  virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const;
87  virtual AbstractFSNode *getParent() const;
88 
90  virtual Common::SeekableWriteStream *createWriteStream(bool atomic);
91  virtual bool createDirectory();
92 
93  static Common::String getHomeDir(void);
94 private:
98  virtual void setFlags();
99 };
100 
101 #endif
virtual Common::String getPath() const
Definition: libretro-fs.h:72
virtual AbstractFSNode * getChild(const Common::String &n) const
virtual bool isDirectory() const
Definition: libretro-fs.h:75
Definition: str.h:59
Definition: array.h:52
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const
Definition: libretro-fs.h:37
virtual Common::SeekableWriteStream * createWriteStream(bool atomic)
virtual bool createDirectory()
Definition: stream.h:745
virtual AbstractFSNode * getParent() const
virtual Common::String getName() const
Definition: libretro-fs.h:69
Definition: ustr.h:57
ListMode
Definition: fs.h:86
virtual Common::SeekableReadStream * createReadStream()
LibRetroFilesystemNode()
Definition: libretro-fs.h:53
Definition: stream.h:351
virtual Common::U32String getDisplayName() const
Definition: libretro-fs.h:66
virtual bool isWritable() const
Definition: libretro-fs.h:81
Definition: abstract-fs.h:41
virtual bool isReadable() const
Definition: libretro-fs.h:78