ManaPlus
Namespaces | Data Structures | Functions
VirtFs Namespace Reference

Namespaces

 anonymous_namespace{fs.cpp}
 
 anonymous_namespace{fsdir.cpp}
 
 FsDir
 
 FsZip
 
 ZipReader
 

Data Structures

struct  DirEntry
 
struct  File
 
struct  FsEntry
 
struct  FsFuncs
 
struct  List
 
struct  ZipEntry
 
struct  ZipLocalHeader
 

Functions

void init (const std::string &name)
 
void updateDirSeparator ()
 
const char * getDirSeparator ()
 
const char * getBaseDir ()
 
const char * getUserDir ()
 
std::vector< FsEntry * > & getEntries ()
 
FsEntrysearchByRootInternal (const std::string &root, const std::string &subDir)
 
FsEntrysearchByTypeInternal (const std::string &root, const FsEntryTypeT type)
 
bool exists (std::string name)
 
ListenumerateFiles (std::string dirName)
 
void getFiles (std::string dirName, StringVect &list)
 
void getFilesWithDir (std::string dirName, StringVect &list)
 
void getDirs (std::string dirName, StringVect &list)
 
bool isDirectory (std::string name)
 
bool isSymbolicLink (const std::string &name)
 
void freeList (List *const handle)
 
FileopenRead (std::string filename)
 
FileopenWrite (std::string filename)
 
FileopenAppend (std::string filename)
 
bool setWriteDir (const std::string &newDir)
 
void addEntry (FsEntry *const entry, const Append append)
 
bool mountDirInternal (const std::string &newDir, std::string subDir, const Append append)
 
bool mountDir (std::string newDir, const Append append)
 
bool mountDir2 (std::string newDir, std::string subDir, const Append append)
 
bool mountDirSilent (std::string newDir, const Append append)
 
bool mountDirSilent2 (std::string newDir, std::string subDir, const Append append)
 
bool unmountDirInternal (std::string oldDir, std::string subDir)
 
bool unmountDir (std::string oldDir)
 
bool unmountDir2 (std::string oldDir, std::string subDir)
 
bool unmountDirSilent (std::string oldDir)
 
bool unmountDirSilent2 (std::string oldDir, std::string subDir)
 
bool mountZip (std::string newDir, const Append append)
 
bool mountZip2 (std::string newDir, std::string subDir, const Append append)
 
bool unmountZip (std::string oldDir)
 
bool unmountZip2 (std::string oldDir, std::string subDir)
 
std::string getRealDir (std::string fileName)
 
bool mkdir (const std::string &dirname)
 
bool remove (const std::string &filename)
 
bool deinit ()
 
void permitLinks (const bool val)
 
int close (File *const file)
 
int64_t read (File *const file, void *const buffer, const uint32_t objSize, const uint32_t objCount)
 
int64_t write (File *const file, const void *const buffer, const uint32_t objSize, const uint32_t objCount)
 
int64_t fileLength (File *const file)
 
int64_t tell (File *const file)
 
int seek (File *const file, const uint64_t pos)
 
int eof (File *const file)
 
const char * loadFile (std::string filename, int &fileSize)
 
SDL_RWops * create_rwops (File *const file, const std::string &fname)
 
SDL_RWops * rwopsOpenRead (const std::string &fname)
 
SDL_RWops * rwopsOpenWrite (const std::string &fname)
 
SDL_RWops * rwopsOpenAppend (const std::string &fname)
 
void searchAndAddArchives (const std::string &path, const std::string &ext, const Append append)
 
void searchAndRemoveArchives (const std::string &path, const std::string &ext)
 
void getFilesInDir (const std::string &dir, StringVect &list, const std::string &ext)
 
std::string getPath (const std::string &file)
 
std::string loadTextFileString (const std::string &fileName)
 
bool loadTextFile (const std::string &fileName, StringVect &lines)
 

Function Documentation

◆ addEntry()

void VirtFs::addEntry ( FsEntry *const  entry,
const Append  append 
)

Definition at line 336 of file fs.cpp.

338  {
339  if (append == Append_true)
340  mEntries.push_back(entry);
341  else
342  mEntries.insert(mEntries.begin(), entry);
343  }
const bool Append_true
Definition: append.h:30
std::vector< FsEntry * > mEntries
Definition: fs.cpp:55

References Append_true, and VirtFs::anonymous_namespace{fs.cpp}::mEntries.

Referenced by mountDirInternal(), mountZip(), and mountZip2().

◆ close()

int VirtFs::close ( File *const  file)

Definition at line 808 of file fs.cpp.

809  {
810  if (file == nullptr)
811  return 0;
812  return file->funcs->close(file);
813  }

◆ create_rwops()

SDL_RWops * VirtFs::create_rwops ( File *const  file,
const std::string &  fname 
)

Definition at line 66 of file rwops.cpp.

68 {
69  SDL_RWops *retval = nullptr;
70 
71  if (file == nullptr)
72  {
73  reportAlways("VirtFs::rwops_seek: create rwops error: %s",
74  fname.c_str())
75  }
76  else
77  {
78  retval = SDL_AllocRW();
79  if (retval != nullptr)
80  {
81 #ifdef USE_SDL2
82  retval->size = file->funcs->rwops_size;
83 #endif // USE_SDL2
84 
85  retval->seek = file->funcs->rwops_seek;
86  retval->read = file->funcs->rwops_read;
87  retval->write = file->funcs->rwops_write;
88  retval->close = file->funcs->rwops_close;
89  retval->hidden.unknown.data1 = file;
90  } /* if */
91  } /* else */
92 
93  return retval;
94 } /* VirtFs::create_rwops */
#define reportAlways(...)
Definition: checkutils.h:253

References VirtFs::File::funcs, reportAlways, VirtFs::FsFuncs::rwops_close, VirtFs::FsFuncs::rwops_read, VirtFs::FsFuncs::rwops_seek, VirtFs::FsFuncs::rwops_write, and VirtFs::FsFuncs::seek.

Referenced by rwopsOpenAppend(), rwopsOpenRead(), and rwopsOpenWrite().

◆ deinit()

bool VirtFs::deinit ( )

Definition at line 785 of file fs.cpp.

786  {
787  FsDir::deinit();
788  FsZip::deinit();
789  FOR_EACH (STD_VECTOR<FsEntry*>::iterator, it, mEntries)
790  {
791  FsEntry *const entry = *it;
792  if (entry->type == FsEntryType::Dir)
793  delete static_cast<DirEntry*>(entry);
794  else if (entry->type == FsEntryType::Zip)
795  delete static_cast<ZipEntry*>(entry);
796  else
797  delete entry;
798  }
799  mEntries.clear();
800  return true;
801  }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:25
bool deinit()
Definition: fs.cpp:785

References VirtFs::FsDir::deinit(), VirtFs::FsZip::deinit(), FsEntryType::Dir, FOR_EACH, VirtFs::anonymous_namespace{fs.cpp}::mEntries, VirtFs::FsEntry::type, and FsEntryType::Zip.

Referenced by Client::gameClear(), main(), mainGui(), and Client::runValidate().

◆ enumerateFiles()

List * VirtFs::enumerateFiles ( std::string  dirName)

Definition at line 147 of file fs.cpp.

148  {
149  List *const list = new List;
150  prepareFsPath(dirName);
151  if (checkPath(dirName) == false)
152  {
153  reportAlways("VirtFs::enumerateFiles invalid path: %s",
154  dirName.c_str())
155  return list;
156  }
157 
158  std::string rootDir = STD_MOVE(dirName);
159  if (findLast(rootDir, std::string(dirSeparator)) == false)
160  rootDir += dirSeparator;
161  StringVect &names = list->names;
162 
163  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
164  {
165  FsEntry *const entry = *it;
166  entry->funcs->enumerate(entry, rootDir, names);
167  }
168 
169  return list;
170  }
const char * dirSeparator
Definition: fs.cpp:43
if(!vert) return
bool checkPath(const std::string &path)
Definition: paths.cpp:121
void prepareFsPath(std::string &path)
Definition: paths.cpp:132
#define STD_MOVE(var)
Definition: stdmove.h:28
bool findLast(const std::string &str1, const std::string &str2)
std::vector< std::string > StringVect
Definition: stringvector.h:29
#define STD_VECTOR
Definition: vector.h:30

References checkPath(), dirSeparator, VirtFs::FsFuncs::enumerate, findLast(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::anonymous_namespace{fs.cpp}::mEntries, VirtFs::List::names, prepareFsPath(), reportAlways, and STD_MOVE.

Referenced by Theme::fillSoundsList(), Wallpaper::loadWallpapers(), searchAndAddArchives(), and searchAndRemoveArchives().

◆ eof()

int VirtFs::eof ( File *const  file)

Definition at line 854 of file fs.cpp.

855  {
856  return file->funcs->eof(file);
857  }

◆ exists()

bool VirtFs::exists ( std::string  name)

Definition at line 124 of file fs.cpp.

125  {
126  prepareFsPath(name);
127  if (checkPath(name) == false)
128  {
129  reportAlways("FsDir::exists invalid path: %s",
130  name.c_str())
131  return false;
132  }
133 
134  std::string rootDir = name;
135  if (findLast(rootDir, std::string(dirSeparator)) == false)
136  rootDir += dirSeparator;
137 
138  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
139  {
140  FsEntry *const entry = *it;
141  if (entry->funcs->exists(entry, name, rootDir) == true)
142  return true;
143  }
144  return false;
145  }

References checkPath(), dirSeparator, VirtFs::FsFuncs::exists, findLast(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), and reportAlways.

Referenced by Game::changeMap(), PoParser::checkLang(), ItemDB::getNamesStr(), Configuration::init(), loadMusic(), Theme::readSkin(), Theme::resolveThemePath(), Minimap::setMap(), Theme::tryThemePath(), and MapReader::updateMusic().

◆ fileLength()

int64_t VirtFs::fileLength ( File *const  file)

Definition at line 837 of file fs.cpp.

838  {
839  return file->funcs->fileLength(file);
840  }

◆ freeList()

void VirtFs::freeList ( List *const  handle)

Definition at line 269 of file fs.cpp.

270  {
271  delete handle;
272  }

Referenced by Theme::fillSoundsList(), Wallpaper::loadWallpapers(), searchAndAddArchives(), and searchAndRemoveArchives().

◆ getBaseDir()

const char * VirtFs::getBaseDir ( )

Definition at line 79 of file fs.cpp.

80  {
81  return FsDir::getBaseDir();
82  }
const char * getBaseDir()
Definition: fs.cpp:79

References VirtFs::FsDir::getBaseDir().

Referenced by getHomePath(), GettextHelper::initLang(), Dirs::initRootDir(), and mainGui().

◆ getDirs()

void VirtFs::getDirs ( std::string  dirName,
StringVect list 
)

Definition at line 217 of file fs.cpp.

219  {
220  prepareFsPath(dirName);
221  if (checkPath(dirName) == false)
222  {
223  reportAlways("VirtFs::enumerateFiles invalid path: %s",
224  dirName.c_str())
225  return;
226  }
227 
228  std::string rootDir = STD_MOVE(dirName);
229  if (findLast(rootDir, std::string(dirSeparator)) == false)
230  rootDir += dirSeparator;
231 
232  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
233  {
234  FsEntry *const entry = *it;
235  entry->funcs->getDirs(entry, rootDir, list);
236  }
237  }

References checkPath(), dirSeparator, findLast(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::FsFuncs::getDirs, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), reportAlways, and STD_MOVE.

Referenced by Theme::fillSkinsList().

◆ getDirSeparator()

const char * VirtFs::getDirSeparator ( )

Definition at line 74 of file fs.cpp.

75  {
76  return dirSeparator;
77  }

References dirSeparator.

◆ getEntries()

std::vector< FsEntry * > & VirtFs::getEntries ( )

Definition at line 89 of file fs.cpp.

90  {
91  return mEntries;
92  }

References VirtFs::anonymous_namespace{fs.cpp}::mEntries.

◆ getFiles()

void VirtFs::getFiles ( std::string  dirName,
StringVect list 
)

Definition at line 172 of file fs.cpp.

174  {
175  prepareFsPath(dirName);
176  if (checkPath(dirName) == false)
177  {
178  reportAlways("VirtFs::enumerateFiles invalid path: %s",
179  dirName.c_str())
180  return;
181  }
182 
183  std::string rootDir = STD_MOVE(dirName);
184  if (findLast(rootDir, std::string(dirSeparator)) == false)
185  rootDir += dirSeparator;
186 
187  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
188  {
189  FsEntry *const entry = *it;
190  entry->funcs->getFiles(entry, rootDir, list);
191  }
192  }

References checkPath(), dirSeparator, findLast(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::FsFuncs::getFiles, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), reportAlways, and STD_MOVE.

Referenced by Theme::fillFontsList().

◆ getFilesInDir()

void VirtFs::getFilesInDir ( const std::string &  dir,
StringVect list,
const std::string &  ext 
)

Definition at line 81 of file tools.cpp.

84  {
85  const std::string &path = dir;
86  StringVect tempList;
87  VirtFs::getFilesWithDir(path, tempList);
88  FOR_EACH (StringVectCIter, it, tempList)
89  {
90  const std::string &str = *it;
91  if (findLast(str, ext))
92  list.push_back(str);
93  }
94  std::sort(list.begin(), list.end());
95  }
void getFilesWithDir(std::string dirName, StringVect &list)
Definition: fs.cpp:194
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:31

References findLast(), FOR_EACH, and getFilesWithDir().

Referenced by ColorDB::load(), ItemDB::load(), loadDB(), and HelpWindow::loadTags().

◆ getFilesWithDir()

void VirtFs::getFilesWithDir ( std::string  dirName,
StringVect list 
)

Definition at line 194 of file fs.cpp.

196  {
197  prepareFsPath(dirName);
198  if (checkPath(dirName) == false)
199  {
200  reportAlways("VirtFs::enumerateFiles invalid path: %s",
201  dirName.c_str())
202  return;
203  }
204 
205  std::string rootDir = STD_MOVE(dirName);
206  if (findLast(rootDir, std::string(dirSeparator)) == false)
207  rootDir += dirSeparator;
208 
209  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
210  {
211  FsEntry *const entry = *it;
212  entry->funcs->getFilesWithDir(entry, rootDir, list);
213  }
214  }

References checkPath(), dirSeparator, findLast(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::FsFuncs::getFilesWithDir, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), reportAlways, and STD_MOVE.

Referenced by getFilesInDir().

◆ getPath()

std::string VirtFs::getPath ( const std::string &  file)

Definition at line 97 of file tools.cpp.

98  {
99  // get the real path to the file
100  const std::string tmp = VirtFs::getRealDir(file);
101  std::string path;
102 
103  // if the file is not in the search path, then its empty
104  if (!tmp.empty())
105  {
106  path = pathJoin(tmp, file);
107 #if defined __native_client__
108  std::string dataZip = "/http/data.zip/";
109  if (path.substr(0, dataZip.length()) == dataZip)
110  path = path.replace(0, dataZip.length(), "/http/data/");
111 #endif // defined __native_client__
112  }
113  else
114  {
115  // if not found in search path return the default path
116  path = pathJoin(getPackageDir(), file);
117  }
118 
119  return path;
120  }
std::string getRealDir(std::string fileName)
Definition: fs.cpp:746
std::string getPackageDir()
Definition: paths.cpp:293
std::string pathJoin(std::string str1, const std::string &str2)

References getPackageDir(), getRealDir(), and pathJoin().

Referenced by Font::openFont(), and WindowManager::setIcon().

◆ getRealDir()

std::string VirtFs::getRealDir ( std::string  fileName)

Definition at line 746 of file fs.cpp.

747  {
749  if (checkPath(fileName) == false)
750  {
751  reportAlways("FsDir::getRealDir invalid path: %s",
752  fileName.c_str())
753  return std::string();
754  }
755 
756  std::string rootDir = fileName;
757  if (findLast(rootDir, std::string(dirSeparator)) == false)
758  rootDir += dirSeparator;
759 
760  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
761  {
762  FsEntry *const entry = *it;
763  std::string realDir;
764  if (entry->funcs->getRealDir(entry,
765  fileName,
766  rootDir,
767  realDir) == true)
768  {
769  return realDir;
770  }
771  }
772  return std::string();
773  }
std::string fileName
Definition: testmain.cpp:39

References checkPath(), dirSeparator, fileName, findLast(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::FsFuncs::getRealDir, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), and reportAlways.

Referenced by getPath(), searchAndAddArchives(), and searchAndRemoveArchives().

◆ getUserDir()

const char * VirtFs::getUserDir ( )

Definition at line 84 of file fs.cpp.

85  {
86  return FsDir::getUserDir();
87  }
const char * getUserDir()
Definition: fs.cpp:84

References VirtFs::FsDir::getUserDir().

Referenced by getPicturesDir(), Dirs::initConfigDir(), Dirs::initLocalDataDir(), and Game::saveScreenshot().

◆ init()

void VirtFs::init ( const std::string &  name)

Definition at line 58 of file fs.cpp.

59  {
61  FsDir::init(name);
62  FsZip::init();
63  }
void init(const std::string &name)
Definition: fs.cpp:58
void updateDirSeparator()
Definition: fs.cpp:65

References VirtFs::FsZip::init(), VirtFs::FsDir::init(), and updateDirSeparator().

Referenced by main(), and mainGui().

◆ isDirectory()

bool VirtFs::isDirectory ( std::string  name)

Definition at line 239 of file fs.cpp.

240  {
241  prepareFsPath(name);
242  if (checkPath(name) == false)
243  {
244  reportAlways("VirtFs::isDirectory invalid path: %s",
245  name.c_str())
246  return false;
247  }
248  std::string dirName = STD_MOVE(name);
249  if (findLast(dirName, std::string(dirSeparator)) == false)
250  dirName += dirSeparator;
251 
252  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
253  {
254  FsEntry *const entry = *it;
255  bool isDirFlag(false);
256  if (entry->funcs->isDirectory(entry, dirName, isDirFlag) == true)
257  {
258  return isDirFlag;
259  }
260  }
261  return false;
262  }

References checkPath(), dirSeparator, findLast(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::FsFuncs::isDirectory, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), reportAlways, and STD_MOVE.

Referenced by Theme::fillSoundsList(), initDefaultThemePath(), initDefaultWallpaperPaths(), and Dirs::initUpdatesDir().

◆ isSymbolicLink()

bool VirtFs::isSymbolicLink ( const std::string &  name)

Definition at line 264 of file fs.cpp.

265  {
266  return FsDir::isSymbolicLink(name);
267  }
bool isSymbolicLink(const std::string &name)
Definition: fs.cpp:264

References VirtFs::FsDir::isSymbolicLink().

◆ loadFile()

const char * VirtFs::loadFile ( std::string  filename,
int &  fileSize 
)

Definition at line 859 of file fs.cpp.

861  {
862  prepareFsPath(filename);
863  if (checkPath(filename) == false)
864  {
865  reportAlways("VirtFs::loadFile invalid path: %s",
866  filename.c_str())
867  return nullptr;
868  }
869  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
870  {
871  FsEntry *const entry = *it;
872  const char *const buf = entry->funcs->loadFile(entry,
873  filename,
874  fileSize);
875  if (buf != nullptr)
876  return buf;
877  }
878  return nullptr;
879  }

References checkPath(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::FsFuncs::loadFile, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), and reportAlways.

Referenced by XML::Document::Document(), UpdaterWindow::getFileHash(), loadTextFile(), loadTextFileString(), PoParser::openFile(), and TranslationManager::translateFile().

◆ loadTextFile()

bool VirtFs::loadTextFile ( const std::string &  fileName,
StringVect lines 
)

Definition at line 137 of file tools.cpp.

139  {
140  int contentsLength;
141  const char *fileContents = VirtFs::loadFile(fileName, contentsLength);
142 
143  if (fileContents == nullptr)
144  {
145  logger->log("Couldn't load text file: %s", fileName.c_str());
146  return false;
147  }
148 
149  std::istringstream iss(std::string(fileContents, contentsLength));
150  std::string line;
151 
152  while (getline(iss, line))
153  lines.push_back(line);
154 
155  delete [] fileContents;
156  return true;
157  }
void log(const char *const log_text,...)
Definition: logger.cpp:269
Logger * logger
Definition: logger.cpp:89
const char * loadFile(std::string filename, int &fileSize)
Definition: fs.cpp:859

References fileName, loadFile(), Logger::log(), and logger.

Referenced by ChatWindow::loadCommandsFile(), PaletteDB::loadPalette(), and HelpWindow::loadTags().

◆ loadTextFileString()

std::string VirtFs::loadTextFileString ( const std::string &  fileName)

Definition at line 122 of file tools.cpp.

123  {
124  int contentsLength;
125  const char *fileContents = VirtFs::loadFile(fileName, contentsLength);
126 
127  if (fileContents == nullptr)
128  {
129  logger->log("Couldn't load text file: %s", fileName.c_str());
130  return std::string();
131  }
132  const std::string str = std::string(fileContents, contentsLength);
133  delete [] fileContents;
134  return str;
135  }

References fileName, loadFile(), Logger::log(), and logger.

Referenced by ShadersManager::createShader().

◆ mkdir()

bool VirtFs::mkdir ( const std::string &  dirname)

Definition at line 775 of file fs.cpp.

776  {
777  return FsDir::mkdir(dirname);
778  }
bool mkdir(const std::string &dirname)
Definition: fs.cpp:775

References VirtFs::FsDir::mkdir().

Referenced by Dirs::initUpdatesDir(), and mkdir_r().

◆ mountDir()

bool VirtFs::mountDir ( std::string  newDir,
const Append  append 
)

Definition at line 393 of file fs.cpp.

395  {
396  prepareFsPath(newDir);
397  if (Files::existsLocal(newDir) == false)
398  {
399  reportNonTests("VirtFs::mount directory not exists: %s",
400  newDir.c_str())
401  return false;
402  }
403  return mountDirInternal(newDir, dirSeparator, append);
404  }
#define reportNonTests(a, b)
Definition: fs.cpp:48
bool existsLocal(const std::string &path)
Definition: files.cpp:209
bool mountDirInternal(const std::string &newDir, std::string subDir, const Append append)
Definition: fs.cpp:345

References dirSeparator, Files::existsLocal(), mountDirInternal(), prepareFsPath(), and reportNonTests.

Referenced by Client::gameExec(), Client::gameInit(), Client::loadData(), UpdaterWindow::loadDirMods(), main(), and Dirs::mountDataDir().

◆ mountDir2()

bool VirtFs::mountDir2 ( std::string  newDir,
std::string  subDir,
const Append  append 
)

Definition at line 406 of file fs.cpp.

409  {
410  prepareFsPath(newDir);
411  prepareFsPath(subDir);
412  if (Files::existsLocal(newDir) == false)
413  {
414  reportNonTests("VirtFs::mount directory not exists: %s",
415  newDir.c_str())
416  return false;
417  }
418  return mountDirInternal(newDir, subDir, append);
419  }

References Files::existsLocal(), mountDirInternal(), prepareFsPath(), and reportNonTests.

◆ mountDirInternal()

bool VirtFs::mountDirInternal ( const std::string &  newDir,
std::string  subDir,
const Append  append 
)

Definition at line 345 of file fs.cpp.

348  {
349  if (newDir.find(".zip") != std::string::npos)
350  {
351  reportAlways("Called FsDir::mount with zip archive")
352  return false;
353  }
354  std::string rootDir = newDir;
355  if (findLast(rootDir, std::string(dirSeparator)) == false)
356  rootDir += dirSeparator;
357  if (subDir == dirSeparator)
358  {
359  subDir.clear();
360  }
361  else if (!subDir.empty() &&
362  findLast(subDir, std::string(dirSeparator)) == false)
363  {
364  subDir += dirSeparator;
365  }
366  const FsEntry *const entry = searchByRootInternal(rootDir, subDir);
367  if (entry != nullptr)
368  {
369  reportAlways("VirtFs::mount already exists: %s",
370  newDir.c_str())
371  return false;
372  }
373  if (subDir.empty())
374  {
375  logger->log("Add virtual directory: " + newDir);
376  }
377  else
378  {
379  logger->log("Add virtual directory: %s with dir %s",
380  newDir.c_str(),
381  subDir.c_str());
382  }
383 
384  addEntry(new DirEntry(newDir,
385  rootDir,
386  subDir,
387  rootDir + subDir,
388  FsDir::getFuncs()),
389  append);
390  return true;
391  }
FsFuncs * getFuncs()
Definition: fsdir.cpp:155
void addEntry(FsEntry *const entry, const Append append)
Definition: fs.cpp:336
FsEntry * searchByRootInternal(const std::string &root, const std::string &subDir)
Definition: fs.cpp:94
std::string empty
Definition: podict.cpp:26

References addEntry(), dirSeparator, findLast(), VirtFs::FsDir::getFuncs(), Logger::log(), logger, reportAlways, and searchByRootInternal().

Referenced by mountDir(), mountDir2(), mountDirSilent(), and mountDirSilent2().

◆ mountDirSilent()

bool VirtFs::mountDirSilent ( std::string  newDir,
const Append  append 
)

Definition at line 421 of file fs.cpp.

423  {
424  prepareFsPath(newDir);
425  if (Files::existsLocal(newDir) == false)
426  {
427  logger->log("VirtFs::mount directory not exists: %s",
428  newDir.c_str());
429  return false;
430  }
431  return mountDirInternal(newDir, std::string(), append);
432  }

References Files::existsLocal(), Logger::log(), logger, mountDirInternal(), and prepareFsPath().

Referenced by Dirs::mountDataDir().

◆ mountDirSilent2()

bool VirtFs::mountDirSilent2 ( std::string  newDir,
std::string  subDir,
const Append  append 
)

Definition at line 434 of file fs.cpp.

437  {
438  prepareFsPath(newDir);
439  prepareFsPath(subDir);
440  if (Files::existsLocal(newDir) == false)
441  {
442  logger->log("VirtFs::mount directory not exists: %s",
443  newDir.c_str());
444  return false;
445  }
446  return mountDirInternal(newDir, subDir, append);
447  }

References Files::existsLocal(), Logger::log(), logger, mountDirInternal(), and prepareFsPath().

◆ mountZip()

bool VirtFs::mountZip ( std::string  newDir,
const Append  append 
)

Definition at line 590 of file fs.cpp.

592  {
593  prepareFsPath(newDir);
594  if (Files::existsLocal(newDir) == false)
595  {
596  reportNonTests("FsZip::mount file not exists: %s",
597  newDir.c_str())
598  return false;
599  }
600  if (findLast(newDir, ".zip") == false)
601  {
602  reportAlways("Called VirtFs::mount without "
603  "zip archive")
604  return false;
605  }
606  if (searchByRootInternal(newDir, std::string()) != nullptr)
607  {
608  reportAlways("FsZip::mount already exists: %s",
609  newDir.c_str())
610  return false;
611  }
612  ZipEntry *const entry = new ZipEntry(newDir,
613  std::string(),
614  FsZip::getFuncs());
615  if (ZipReader::readArchiveInfo(entry) == false)
616  {
617  delete entry;
618  return false;
619  }
620 
621  logger->log("Add virtual zip: " + newDir);
622  addEntry(entry, append);
623  return true;
624  }
#define new
Definition: debug_new.h:147
bool readArchiveInfo(ZipEntry *entry)
Definition: zipreader.cpp:75

References addEntry(), Files::existsLocal(), findLast(), VirtFs::FsZip::getFuncs(), Logger::log(), logger, prepareFsPath(), VirtFs::ZipReader::readArchiveInfo(), reportAlways, reportNonTests, and searchByRootInternal().

Referenced by UpdaterWindow::addUpdateFile(), UpdaterWindow::loadManaPlusUpdates(), UpdaterWindow::loadMods(), Dirs::mountDataDir(), and searchAndAddArchives().

◆ mountZip2()

bool VirtFs::mountZip2 ( std::string  newDir,
std::string  subDir,
const Append  append 
)

Definition at line 626 of file fs.cpp.

629  {
630  prepareFsPath(newDir);
631  if (Files::existsLocal(newDir) == false)
632  {
633  reportNonTests("FsZip::mount file not exists: %s",
634  newDir.c_str())
635  return false;
636  }
637  if (findLast(newDir, ".zip") == false)
638  {
639  reportAlways("Called VirtFs::mount without "
640  "zip archive")
641  return false;
642  }
643  prepareFsPath(subDir);
644  if (subDir == dirSeparator)
645  {
646  subDir.clear();
647  }
648  else if (!subDir.empty() &&
649  findLast(subDir, std::string(dirSeparator)) == false)
650  {
651  subDir += dirSeparator;
652  }
653  if (searchByRootInternal(newDir, subDir) != nullptr)
654  {
655  reportAlways("FsZip::mount already exists: %s",
656  newDir.c_str())
657  return false;
658  }
659  ZipEntry *const entry = new ZipEntry(newDir,
660  subDir,
661  FsZip::getFuncs());
662  if (ZipReader::readArchiveInfo(entry) == false)
663  {
664  delete entry;
665  return false;
666  }
667 
668  logger->log("Add virtual zip: %s with dir %s",
669  newDir.c_str(),
670  subDir.c_str());
671  addEntry(entry, append);
672  return true;
673  }

References addEntry(), dirSeparator, Files::existsLocal(), findLast(), VirtFs::FsZip::getFuncs(), Logger::log(), logger, prepareFsPath(), VirtFs::ZipReader::readArchiveInfo(), reportAlways, reportNonTests, and searchByRootInternal().

Referenced by Dirs::extractDataDir(), and Dirs::mountDataDir().

◆ openAppend()

File * VirtFs::openAppend ( std::string  filename)

Definition at line 312 of file fs.cpp.

313  {
314  prepareFsPath(filename);
315  if (checkPath(filename) == false)
316  {
317  reportAlways("VirtFs::openAppend invalid path: %s",
318  filename.c_str())
319  return nullptr;
320  }
321  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
322  {
323  FsEntry *const entry = *it;
324  File *const file = entry->funcs->openAppend(entry, filename);
325  if (file != nullptr)
326  return file;
327  }
328  return nullptr;
329  }

References checkPath(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::anonymous_namespace{fs.cpp}::mEntries, VirtFs::FsFuncs::openAppend, prepareFsPath(), and reportAlways.

Referenced by rwopsOpenAppend().

◆ openRead()

File * VirtFs::openRead ( std::string  filename)

Definition at line 274 of file fs.cpp.

275  {
276  prepareFsPath(filename);
277  if (checkPath(filename) == false)
278  {
279  reportAlways("VirtFs::openRead invalid path: %s",
280  filename.c_str())
281  return nullptr;
282  }
283  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
284  {
285  FsEntry *const entry = *it;
286  File *const file = entry->funcs->openRead(entry, filename);
287  if (file != nullptr)
288  return file;
289  }
290  return nullptr;
291  }

References checkPath(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::anonymous_namespace{fs.cpp}::mEntries, VirtFs::FsFuncs::openRead, prepareFsPath(), and reportAlways.

Referenced by rwopsOpenRead().

◆ openWrite()

File * VirtFs::openWrite ( std::string  filename)

Definition at line 293 of file fs.cpp.

294  {
295  prepareFsPath(filename);
296  if (checkPath(filename) == false)
297  {
298  reportAlways("VirtFs::openWrite invalid path: %s",
299  filename.c_str())
300  return nullptr;
301  }
302  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
303  {
304  FsEntry *const entry = *it;
305  File *const file = entry->funcs->openWrite(entry, filename);
306  if (file != nullptr)
307  return file;
308  }
309  return nullptr;
310  }

References checkPath(), FOR_EACH, VirtFs::FsEntry::funcs, VirtFs::anonymous_namespace{fs.cpp}::mEntries, VirtFs::FsFuncs::openWrite, prepareFsPath(), and reportAlways.

Referenced by rwopsOpenWrite().

◆ permitLinks()

void VirtFs::permitLinks ( const bool  val)

Definition at line 803 of file fs.cpp.

804  {
805  FsDir::permitLinks(val);
806  }
void permitLinks(const bool val)
Definition: fs.cpp:803

References VirtFs::FsDir::permitLinks().

Referenced by Theme::fillFontsList().

◆ read()

int64_t VirtFs::read ( File *const  file,
void *const  buffer,
const uint32_t  objSize,
const uint32_t  objCount 
)

Definition at line 815 of file fs.cpp.

819  {
820  return file->funcs->read(file,
821  buffer,
822  objSize,
823  objCount);
824  }

Referenced by Net::Download::fadler32().

◆ remove()

bool VirtFs::remove ( const std::string &  filename)

Definition at line 780 of file fs.cpp.

781  {
782  return FsDir::remove(filename);
783  }
bool remove(const std::string &filename)
Definition: fs.cpp:780

References VirtFs::FsDir::remove().

Referenced by ConfigManager::backupConfig(), Files::deleteFilesInDirectory(), Net::Download::downloadThread(), Configuration::removeListeners(), and Files::renameFile().

◆ rwopsOpenAppend()

SDL_RWops * VirtFs::rwopsOpenAppend ( const std::string &  fname)

Definition at line 143 of file rwops.cpp.

144 {
145 #ifdef __APPLE__
146  if (!checkFilePath(fname))
147  return nullptr;
148 #endif // __APPLE__
149 
150  return create_rwops(openAppend(fname),
151  fname);
152 } /* RWopsopenAppend */
SDL_RWops * create_rwops(File *const file, const std::string &fname)
Definition: rwops.cpp:66
File * openAppend(std::string filename)
Definition: fs.cpp:312

References create_rwops(), and openAppend().

◆ rwopsOpenRead()

SDL_RWops * VirtFs::rwopsOpenRead ( const std::string &  fname)

Definition at line 107 of file rwops.cpp.

108 {
109  BLOCK_START("RWopsopenRead")
110 #ifdef __APPLE__
111  if (!checkFilePath(fname))
112  return nullptr;
113 #endif // __APPLE__
114 #ifdef USE_FUZZER
115  if (Fuzzer::conditionTerminate(fname))
116  return nullptr;
117 #endif // USE_FUZZER
118 #ifdef USE_PROFILER
119 
120  SDL_RWops *const ret = create_rwops(openRead(fname),
121  fname);
122 
123  BLOCK_END("RWopsopenRead")
124  return ret;
125 #else // USE_PROFILER
126 
127  return create_rwops(openRead(fname),
128  fname);
129 #endif // USE_PROFILER
130 } /* RWopsopenRead */
File * openRead(std::string filename)
Definition: fs.cpp:274
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79

References BLOCK_END, BLOCK_START, create_rwops(), and openRead().

Referenced by anonymous_namespace{imageloader.cpp}::DyedImageLoader::load(), anonymous_namespace{musicloader.cpp}::ResourceLoader::load(), anonymous_namespace{soundloader.cpp}::ResourceLoader::load(), AtlasManager::loadImages(), and Font::openFont().

◆ rwopsOpenWrite()

SDL_RWops * VirtFs::rwopsOpenWrite ( const std::string &  fname)

Definition at line 132 of file rwops.cpp.

133 {
134 #ifdef __APPLE__
135  if (!checkFilePath(fname))
136  return nullptr;
137 #endif // __APPLE__
138 
139  return create_rwops(openWrite(fname),
140  fname);
141 } /* RWopsopenWrite */
File * openWrite(std::string filename)
Definition: fs.cpp:293

References create_rwops(), and openWrite().

◆ searchAndAddArchives()

void VirtFs::searchAndAddArchives ( const std::string &  path,
const std::string &  ext,
const Append  append 
)

Definition at line 41 of file tools.cpp.

44  {
45  List *const list = VirtFs::enumerateFiles(path);
46  FOR_EACH (StringVectCIter, i, list->names)
47  {
48  const std::string str = *i;
49  const size_t len = str.size();
50 
51  if (len > ext.length() &&
52  ext == str.substr(len - ext.length()))
53  {
54  const std::string file = path + str;
55  const std::string realPath = VirtFs::getRealDir(file);
56  VirtFs::mountZip(pathJoin(realPath, file), append);
57  }
58  }
59  VirtFs::freeList(list);
60  }
void freeList(List *const handle)
Definition: fs.cpp:269
bool mountZip(std::string newDir, const Append append)
Definition: fs.cpp:590
List * enumerateFiles(std::string dirName)
Definition: fs.cpp:147

References enumerateFiles(), FOR_EACH, freeList(), getRealDir(), mountZip(), VirtFs::List::names, and pathJoin().

Referenced by Client::gameExec(), and Client::loadData().

◆ searchAndRemoveArchives()

void VirtFs::searchAndRemoveArchives ( const std::string &  path,
const std::string &  ext 
)

Definition at line 62 of file tools.cpp.

64  {
65  List *const list = VirtFs::enumerateFiles(path);
66  FOR_EACH (StringVectCIter, i, list->names)
67  {
68  const std::string str = *i;
69  const size_t len = str.size();
70  if (len > ext.length() &&
71  ext == str.substr(len - ext.length()))
72  {
73  const std::string file = path + str;
74  const std::string realPath = VirtFs::getRealDir(file);
75  VirtFs::unmountZip(pathJoin(realPath, file));
76  }
77  }
78  VirtFs::freeList(list);
79  }
bool unmountZip(std::string oldDir)
Definition: fs.cpp:675

References enumerateFiles(), FOR_EACH, freeList(), getRealDir(), VirtFs::List::names, pathJoin(), and unmountZip().

Referenced by Client::unloadData().

◆ searchByRootInternal()

FsEntry * VirtFs::searchByRootInternal ( const std::string &  root,
const std::string &  subDir 
)

Definition at line 94 of file fs.cpp.

96  {
97  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
98  {
99  const FsEntry *const entry = *it;
100  if (entry->root == root &&
101  entry->subDir == subDir)
102  {
103  return *it;
104  }
105  }
106  return nullptr;
107  }

References FOR_EACH, VirtFs::anonymous_namespace{fs.cpp}::mEntries, VirtFs::FsEntry::root, and VirtFs::FsEntry::subDir.

Referenced by mountDirInternal(), mountZip(), and mountZip2().

◆ searchByTypeInternal()

FsEntry * VirtFs::searchByTypeInternal ( const std::string &  root,
const FsEntryTypeT  type 
)

Definition at line 109 of file fs.cpp.

111  {
112  FOR_EACH (STD_VECTOR<FsEntry*>::const_iterator, it, mEntries)
113  {
114  const FsEntry *const entry = *it;
115  if (entry->root == root &&
116  entry->type == type)
117  {
118  return *it;
119  }
120  }
121  return nullptr;
122  }

References FOR_EACH, VirtFs::anonymous_namespace{fs.cpp}::mEntries, VirtFs::FsEntry::root, and VirtFs::FsEntry::type.

◆ seek()

int VirtFs::seek ( File *const  file,
const uint64_t  pos 
)

Definition at line 847 of file fs.cpp.

849  {
850  return file->funcs->seek(file,
851  pos);
852  }

Referenced by TextManager::place().

◆ setWriteDir()

bool VirtFs::setWriteDir ( const std::string &  newDir)

Definition at line 331 of file fs.cpp.

332  {
333  return FsDir::setWriteDir(newDir);
334  }
bool setWriteDir(const std::string &newDir)
Definition: fs.cpp:331

References VirtFs::FsDir::setWriteDir().

Referenced by Client::gameInit(), and main().

◆ tell()

int64_t VirtFs::tell ( File *const  file)

Definition at line 842 of file fs.cpp.

843  {
844  return file->funcs->tell(file);
845  }

◆ unmountDir()

bool VirtFs::unmountDir ( std::string  oldDir)

Definition at line 518 of file fs.cpp.

519  {
520  prepareFsPath(oldDir);
521  if (oldDir.find(".zip") != std::string::npos)
522  {
523  reportAlways("Called unmount with zip archive")
524  return false;
525  }
526  if (unmountDirInternal(oldDir, std::string()) == false)
527  {
528  reportAlways("VirtFs::unmountDir not exists: %s",
529  oldDir.c_str())
530  return false;
531  }
532  return true;
533  }
bool unmountDirInternal(std::string oldDir, std::string subDir)
Definition: fs.cpp:477

References prepareFsPath(), reportAlways, and unmountDirInternal().

Referenced by UpdaterWindow::unloadMods().

◆ unmountDir2()

bool VirtFs::unmountDir2 ( std::string  oldDir,
std::string  subDir 
)

Definition at line 535 of file fs.cpp.

537  {
538  prepareFsPath(oldDir);
539  if (oldDir.find(".zip") != std::string::npos)
540  {
541  reportAlways("Called unmount with zip archive")
542  return false;
543  }
544  prepareFsPath(subDir);
545  if (unmountDirInternal(oldDir, subDir) == false)
546  {
547  reportAlways("VirtFs::unmountDir not exists: %s",
548  oldDir.c_str())
549  return false;
550  }
551  return true;
552  }

References prepareFsPath(), reportAlways, and unmountDirInternal().

◆ unmountDirInternal()

bool VirtFs::unmountDirInternal ( std::string  oldDir,
std::string  subDir 
)

Definition at line 477 of file fs.cpp.

479  {
480  if (findLast(oldDir, std::string(dirSeparator)) == false)
481  oldDir += dirSeparator;
482  if (subDir == dirSeparator)
483  {
484  subDir.clear();
485  }
486  else if (!subDir.empty() &&
487  findLast(subDir, std::string(dirSeparator)) == false)
488  {
489  subDir += dirSeparator;
490  }
491  FOR_EACH (STD_VECTOR<FsEntry*>::iterator, it, mEntries)
492  {
493  FsEntry *const entry = *it;
494  if (entry->root == oldDir &&
495  entry->type == FsEntryType::Dir &&
496  entry->subDir == subDir)
497  {
498  DirEntry *const dirEntry = static_cast<DirEntry*>(
499  entry);
500  if (subDir.empty())
501  {
502  logger->log("Remove virtual directory: " + oldDir);
503  }
504  else
505  {
506  logger->log("Remove virtual directory: %s with dir %s",
507  oldDir.c_str(),
508  subDir.c_str());
509  }
510  mEntries.erase(it);
511  delete dirEntry;
512  return true;
513  }
514  }
515  return false;
516  }

References FsEntryType::Dir, dirSeparator, findLast(), FOR_EACH, Logger::log(), logger, VirtFs::anonymous_namespace{fs.cpp}::mEntries, VirtFs::FsEntry::root, VirtFs::FsEntry::subDir, and VirtFs::FsEntry::type.

Referenced by unmountDir(), unmountDir2(), unmountDirSilent(), and unmountDirSilent2().

◆ unmountDirSilent()

bool VirtFs::unmountDirSilent ( std::string  oldDir)

Definition at line 554 of file fs.cpp.

555  {
556  prepareFsPath(oldDir);
557  if (oldDir.find(".zip") != std::string::npos)
558  {
559  reportAlways("Called unmount with zip archive")
560  return false;
561  }
562  if (unmountDirInternal(oldDir, std::string()) == false)
563  {
564  logger->log("VirtFs::unmountDir not exists: %s",
565  oldDir.c_str());
566  return false;
567  }
568  return true;
569  }

References Logger::log(), logger, prepareFsPath(), reportAlways, and unmountDirInternal().

Referenced by Client::unloadData().

◆ unmountDirSilent2()

bool VirtFs::unmountDirSilent2 ( std::string  oldDir,
std::string  subDir 
)

Definition at line 571 of file fs.cpp.

573  {
574  prepareFsPath(oldDir);
575  if (oldDir.find(".zip") != std::string::npos)
576  {
577  reportAlways("Called unmount with zip archive")
578  return false;
579  }
580  prepareFsPath(subDir);
581  if (unmountDirInternal(oldDir, subDir) == false)
582  {
583  logger->log("VirtFs::unmountDir not exists: %s",
584  oldDir.c_str());
585  return false;
586  }
587  return true;
588  }

References Logger::log(), logger, prepareFsPath(), reportAlways, and unmountDirInternal().

◆ unmountZip()

bool VirtFs::unmountZip ( std::string  oldDir)

Definition at line 675 of file fs.cpp.

676  {
677  prepareFsPath(oldDir);
678  if (findLast(oldDir, ".zip") == false)
679  {
680  reportAlways("Called unmount without zip archive")
681  return false;
682  }
683  FOR_EACH (STD_VECTOR<FsEntry*>::iterator, it, mEntries)
684  {
685  FsEntry *const entry = *it;
686  if (entry->root == oldDir &&
687  entry->type == FsEntryType::Zip &&
688  entry->subDir.empty())
689  {
690  ZipEntry *const zipEntry = static_cast<ZipEntry*>(
691  entry);
692  logger->log("Remove virtual zip: " + oldDir);
693  mEntries.erase(it);
694  delete zipEntry;
695  return true;
696  }
697  }
698 
699  reportAlways("VirtFs::unmountZip not exists: %s",
700  oldDir.c_str())
701  return false;
702  }

References findLast(), FOR_EACH, Logger::log(), logger, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), reportAlways, VirtFs::FsEntry::root, VirtFs::FsEntry::subDir, VirtFs::FsEntry::type, and FsEntryType::Zip.

Referenced by UpdaterWindow::removeUpdateFile(), searchAndRemoveArchives(), and UpdaterWindow::unloadManaPlusUpdates().

◆ unmountZip2()

bool VirtFs::unmountZip2 ( std::string  oldDir,
std::string  subDir 
)

Definition at line 704 of file fs.cpp.

706  {
707  prepareFsPath(oldDir);
708  if (findLast(oldDir, ".zip") == false)
709  {
710  reportAlways("Called unmount without zip archive")
711  return false;
712  }
713  prepareFsPath(subDir);
714  if (subDir == dirSeparator)
715  {
716  subDir.clear();
717  }
718  else if (!subDir.empty() &&
719  findLast(subDir, std::string(dirSeparator)) == false)
720  {
721  subDir += dirSeparator;
722  }
723  FOR_EACH (STD_VECTOR<FsEntry*>::iterator, it, mEntries)
724  {
725  FsEntry *const entry = *it;
726  if (entry->root == oldDir &&
727  entry->type == FsEntryType::Zip &&
728  entry->subDir == subDir)
729  {
730  ZipEntry *const zipEntry = static_cast<ZipEntry*>(
731  entry);
732  logger->log("Remove virtual zip: %s with dir %s",
733  oldDir.c_str(),
734  subDir.c_str());
735  mEntries.erase(it);
736  delete zipEntry;
737  return true;
738  }
739  }
740 
741  reportAlways("VirtFs::unmountZip not exists: %s",
742  oldDir.c_str())
743  return false;
744  }

References dirSeparator, findLast(), FOR_EACH, Logger::log(), logger, VirtFs::anonymous_namespace{fs.cpp}::mEntries, prepareFsPath(), reportAlways, VirtFs::FsEntry::root, VirtFs::FsEntry::subDir, VirtFs::FsEntry::type, and FsEntryType::Zip.

◆ updateDirSeparator()

void VirtFs::updateDirSeparator ( )

Definition at line 65 of file fs.cpp.

66  {
67 #ifdef WIN32
68  dirSeparator = "\\";
69 #else // WIN32
70  dirSeparator = "/";
71 #endif // WIN32
72  }

References dirSeparator.

Referenced by init().

◆ write()

int64_t VirtFs::write ( File *const  file,
const void *const  buffer,
const uint32_t  objSize,
const uint32_t  objCount 
)

Definition at line 826 of file fs.cpp.

830  {
831  return file->funcs->write(file,
832  buffer,
833  objSize,
834  objCount);
835  }

Referenced by Net::Download::setWriteFunction().