geode/loader/include/Geode/utils/platform.hpp

46 lines
1.1 KiB
C++
Raw Normal View History

2022-07-30 12:24:03 -04:00
#pragma once
#include "Result.hpp"
2022-10-30 14:59:20 -04:00
#include "fs/filesystem.hpp"
#include <Geode/DefaultInclude.hpp>
#include <functional>
2022-07-30 12:24:03 -04:00
#include <string>
#include <unordered_set>
2022-07-30 12:24:03 -04:00
#include <vector>
namespace geode::utils::clipboard {
GEODE_DLL bool write(std::string const& data);
GEODE_DLL std::string read();
}
namespace geode::utils::file {
2022-07-30 12:24:03 -04:00
GEODE_DLL ghc::filesystem::path geodeRoot();
GEODE_DLL bool openFolder(ghc::filesystem::path const& path);
enum class PickMode {
OpenFile,
SaveFile,
OpenFolder,
};
struct FilePickOptions {
struct Filter {
// Name of the filter
std::string description;
// Extensions (*.txt, *.doc, *.mp3, etc.)
std::unordered_set<std::string> files;
};
2022-10-30 14:59:20 -04:00
ghc::filesystem::path defaultPath;
std::vector<Filter> filters;
};
2022-10-30 14:59:20 -04:00
GEODE_DLL Result<ghc::filesystem::path> pickFile(PickMode mode, FilePickOptions const& options);
GEODE_DLL Result<std::vector<ghc::filesystem::path>> pickFiles(FilePickOptions const& options);
2022-07-30 12:24:03 -04:00
}
namespace geode::utils::web {
GEODE_DLL void openLinkInBrowser(std::string const& url);
}