/*
TessesFramework a library to make C++ easier for me, used in CrossLang:
https://git.tesses.org/tesses50/crosslang Copyright (C) 2026 Mike Nolan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
#pragma once
#include "TempFS.hpp"
#include "VFSFix.hpp"
namespace Tesses::Framework::Filesystem::Helpers {
void ReadAllText(std::shared_ptr vfs, VFSPath path, std::string &text);
void ReadAllLines(std::shared_ptr vfs, VFSPath path,
std::vector &lines);
void ReadAllBytes(std::shared_ptr vfs, VFSPath path,
std::vector &array);
std::string ReadAllText(std::shared_ptr vfs, VFSPath path);
std::vector ReadAllLines(std::shared_ptr vfs, VFSPath path);
std::vector ReadAllBytes(std::shared_ptr vfs, VFSPath path);
void WriteAllText(std::shared_ptr vfs, VFSPath path,
const std::string &text);
void WriteAllLines(std::shared_ptr vfs, VFSPath path,
const std::vector &parts);
void WriteAllBytes(std::shared_ptr vfs, VFSPath path,
const std::vector &bytes);
void CopyStreamProgress(
std::shared_ptr src, std::shared_ptr dest,
std::function progress);
void CopyFile(std::shared_ptr vfsSrc, VFSPath pathSrc,
std::shared_ptr vfsDest, VFSPath pathDest,
bool overwrite = true);
void CopyFile(std::shared_ptr vfsSrc, VFSPath pathSrc,
std::shared_ptr vfsDest, VFSPath pathDest,
std::function progress,
bool overwrite = true);
void CopyDirectory(std::shared_ptr vfsSrc, VFSPath pathSrc,
std::shared_ptr vfsDest, VFSPath pathDest,
bool overwrite = true);
void CopyDirectory(
std::shared_ptr vfsSrc, VFSPath pathSrc, std::shared_ptr vfsDest,
VFSPath pathDest,
std::function
progress,
bool overwrite = true);
inline std::shared_ptr CreateTempFS(bool deleteOnDestroy = true) {
return std::make_shared(deleteOnDestroy);
}
inline std::shared_ptr CreateTempFS(std::shared_ptr vfs,
bool deleteOnDestroy = true) {
return std::make_shared(vfs, deleteOnDestroy);
}
} // namespace Tesses::Framework::Filesystem::Helpers