2022-03-04 11:36:37 +01:00
|
|
|
#pragma once
|
|
|
|
|
2022-10-02 14:18:40 +02:00
|
|
|
#include <hex.hpp>
|
|
|
|
|
2022-03-22 09:34:26 +01:00
|
|
|
#include <optional>
|
2022-03-04 11:36:37 +01:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <filesystem>
|
2022-03-04 11:44:11 +01:00
|
|
|
#include <functional>
|
2022-03-04 11:36:37 +01:00
|
|
|
|
|
|
|
#include <nfd.hpp>
|
|
|
|
|
2023-03-12 18:27:29 +01:00
|
|
|
#include <wolv/io/fs.hpp>
|
2022-03-04 11:36:37 +01:00
|
|
|
|
|
|
|
namespace hex::fs {
|
|
|
|
|
2022-09-20 15:47:59 +02:00
|
|
|
enum class DialogMode {
|
2022-03-04 11:36:37 +01:00
|
|
|
Open,
|
|
|
|
Save,
|
|
|
|
Folder
|
|
|
|
};
|
|
|
|
|
2023-03-26 11:02:51 +02:00
|
|
|
void setFileBrowserErrorCallback(const std::function<void(const std::string&)> &callback);
|
2023-01-28 00:01:53 +01:00
|
|
|
bool openFileBrowser(DialogMode mode, const std::vector<nfdfilteritem_t> &validExtensions, const std::function<void(std::fs::path)> &callback, const std::string &defaultPath = {}, bool multiple = false);
|
2022-03-04 11:36:37 +01:00
|
|
|
|
2022-10-02 14:18:40 +02:00
|
|
|
enum class ImHexPath : u32 {
|
|
|
|
Patterns = 0,
|
2022-03-04 11:36:37 +01:00
|
|
|
PatternsInclude,
|
|
|
|
Magic,
|
|
|
|
Plugins,
|
|
|
|
Yara,
|
|
|
|
Config,
|
|
|
|
Resources,
|
|
|
|
Constants,
|
|
|
|
Encodings,
|
2022-08-14 10:07:45 +02:00
|
|
|
Logs,
|
2022-10-02 14:18:40 +02:00
|
|
|
Recent,
|
|
|
|
Scripts,
|
|
|
|
Inspectors,
|
2022-12-29 19:26:00 +01:00
|
|
|
Themes,
|
2023-01-07 10:32:01 +01:00
|
|
|
Libraries,
|
2023-02-09 23:07:04 +01:00
|
|
|
Nodes,
|
2023-05-11 18:44:50 +02:00
|
|
|
Layouts,
|
2022-10-02 14:18:40 +02:00
|
|
|
|
|
|
|
END
|
2022-03-04 11:36:37 +01:00
|
|
|
};
|
|
|
|
|
2023-03-12 18:27:29 +01:00
|
|
|
bool isPathWritable(const std::fs::path &path);
|
2022-03-04 11:36:37 +01:00
|
|
|
|
|
|
|
std::vector<std::fs::path> getDefaultPaths(ImHexPath path, bool listNonExisting = false);
|
|
|
|
|
2023-03-26 11:02:23 +02:00
|
|
|
// temporarily expose these for the migration function
|
|
|
|
std::vector<std::fs::path> getDataPaths();
|
|
|
|
std::vector<std::fs::path> appendPath(std::vector<std::fs::path> paths, const std::fs::path &folder);
|
2022-03-04 11:36:37 +01:00
|
|
|
}
|