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
38protected:
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), _isReadable(false), _isWritable(false) {}
54
55public:
62
63 virtual bool exists() const {
64 return _isValid;
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
91 virtual bool createDirectory();
92
93 static Common::String getHomeDir(void);
94 static Common::String getDefaultDir(void);
95 static Common::String getAuthorizedRootPath(void);
96 static void clearAuthorizedLocations(void);
97 static void addAuthorizedLocation(const Common::String &path, const Common::String &label);
98 static bool hasAuthorizedLocations(void);
99 static bool useAuthorizedRoot(void);
100 static bool isBrowserLastPathCompatible(const Common::String &path);
101private:
105 virtual void setFlags();
106};
107
108#endif
Definition: abstract-fs.h:41
Definition: array.h:52
ListMode
Definition: fs.h:86
Definition: stream.h:745
Definition: stream.h:351
Definition: str.h:59
Definition: ustr.h:57
Definition: libretro-fs.h:37
virtual Common::String getPath() const
Definition: libretro-fs.h:72
virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const
virtual AbstractFSNode * getParent() const
virtual Common::String getName() const
Definition: libretro-fs.h:69
virtual bool isDirectory() const
Definition: libretro-fs.h:75
virtual Common::U32String getDisplayName() const
Definition: libretro-fs.h:66
virtual bool isWritable() const
Definition: libretro-fs.h:81
virtual Common::SeekableWriteStream * createWriteStream(bool atomic)
LibRetroFilesystemNode(const Common::String &path)
LibRetroFilesystemNode()
Definition: libretro-fs.h:53
virtual AbstractFSNode * getChild(const Common::String &n) const
virtual Common::SeekableReadStream * createReadStream()
virtual bool createDirectory()
virtual bool isReadable() const
Definition: libretro-fs.h:78