openMSX
FileContext.hh
Go to the documentation of this file.
1 #ifndef FILECONTEXT_HH
2 #define FILECONTEXT_HH
3 
4 #include "string_view.hh"
5 #include <vector>
6 
7 namespace openmsx {
8 
9 class FileContext final
10 {
11 public:
13  FileContext(std::vector<std::string>&& paths,
14  std::vector<std::string>&& savePaths);
15 
16  const std::string resolve (string_view filename) const;
17  const std::string resolveCreate(string_view filename) const;
18 
19  std::vector<std::string> getPaths() const;
20  bool isUserContext() const;
21 
22  template<typename Archive>
23  void serialize(Archive& ar, unsigned version);
24 
25 private:
26  std::vector<std::string> paths;
27  std::vector<std::string> savePaths;
28 };
29 
36 
37 } // namespace openmsx
38 
39 #endif
FileContext userDataFileContext(string_view subDir)
Definition: FileContext.cc:171
FileContext configFileContext(string_view path, string_view hwDescr, string_view userName)
Definition: FileContext.cc:142
FileContext preferSystemFileContext()
Definition: FileContext.cc:155
FileContext systemFileContext()
Definition: FileContext.cc:149
const std::string resolve(string_view filename) const
Definition: FileContext.cc:77
bool isUserContext() const
Definition: FileContext.cc:109
FileContext userFileContext(string_view savePath)
Definition: FileContext.cc:161
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
FileContext currentDirFileContext()
Definition: FileContext.cc:177
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:15
std::vector< std::string > getPaths() const
Definition: FileContext.cc:104
void serialize(Archive &ar, unsigned version)
Definition: FileContext.cc:115
const std::string resolveCreate(string_view filename) const
Definition: FileContext.cc:85