2022-07-30 12:24:03 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Result.hpp"
|
|
|
|
#include "types.hpp"
|
2022-10-30 14:59:20 -04:00
|
|
|
|
|
|
|
#include <Geode/DefaultInclude.hpp>
|
2022-10-05 08:41:05 -04:00
|
|
|
#include <fs/filesystem.hpp>
|
2022-10-30 14:59:20 -04:00
|
|
|
#include <string>
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-09-26 06:53:40 -04:00
|
|
|
namespace geode::utils::file {
|
2022-10-30 14:59:20 -04:00
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<std::string>
|
|
|
|
readString(std::string const& path);
|
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<std::string>
|
|
|
|
readString(std::wstring const& path);
|
|
|
|
GEODE_DLL Result<std::string> readString(ghc::filesystem::path const& path);
|
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<byte_array> readBinary(
|
|
|
|
std::string const& path
|
|
|
|
);
|
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<byte_array> readBinary(
|
|
|
|
std::wstring const& path
|
|
|
|
);
|
|
|
|
GEODE_DLL Result<byte_array> readBinary(ghc::filesystem::path const& path);
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-10-30 14:59:20 -04:00
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<> writeString(
|
|
|
|
std::string const& path, std::string const& data
|
|
|
|
);
|
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<> writeString(
|
|
|
|
std::wstring const& path, std::string const& data
|
|
|
|
);
|
2022-07-30 12:24:03 -04:00
|
|
|
GEODE_DLL Result<> writeString(ghc::filesystem::path const& path, std::string const& data);
|
2022-10-30 14:59:20 -04:00
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<> writeBinary(
|
|
|
|
std::string const& path, byte_array const& data
|
|
|
|
);
|
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<> writeBinary(
|
|
|
|
std::wstring const& path, byte_array const& data
|
|
|
|
);
|
|
|
|
GEODE_DLL Result<> writeBinary(ghc::filesystem::path const& path, byte_array const& data);
|
2022-07-30 12:24:03 -04:00
|
|
|
|
2022-10-30 14:59:20 -04:00
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<> createDirectory(
|
|
|
|
std::string const& path
|
|
|
|
);
|
2022-10-13 14:37:59 -04:00
|
|
|
GEODE_DLL Result<> createDirectory(ghc::filesystem::path const& path);
|
2022-10-30 14:59:20 -04:00
|
|
|
[[deprecated("Use the ghc::filesystem::path version")]] GEODE_DLL Result<> createDirectoryAll(
|
|
|
|
std::string const& path
|
|
|
|
);
|
2022-10-13 14:37:59 -04:00
|
|
|
GEODE_DLL Result<> createDirectoryAll(ghc::filesystem::path const& path);
|
2022-07-30 12:24:03 -04:00
|
|
|
GEODE_DLL Result<std::vector<std::string>> listFiles(std::string const& path);
|
|
|
|
GEODE_DLL Result<std::vector<std::string>> listFilesRecursively(std::string const& path);
|
2022-10-05 08:41:05 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unzip file to directory
|
|
|
|
* @param from File to unzip
|
|
|
|
* @param to Directory to unzip to
|
|
|
|
* @returns Ok on success, Error on error
|
|
|
|
*/
|
2022-10-30 14:59:20 -04:00
|
|
|
GEODE_DLL Result<> unzipTo(ghc::filesystem::path const& from, ghc::filesystem::path const& to);
|
2022-07-30 12:24:03 -04:00
|
|
|
}
|