2022-03-04 11:36:37 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <filesystem>
|
2022-03-04 11:44:11 +01:00
|
|
|
#include <functional>
|
2022-03-04 11:36:37 +01:00
|
|
|
|
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-10-04 12:00:32 +02:00
|
|
|
struct ItemFilter {
|
|
|
|
// Human-friendly name
|
|
|
|
std::string name;
|
|
|
|
// Extensions that constitute this filter
|
|
|
|
std::string spec;
|
|
|
|
};
|
|
|
|
|
2023-03-26 11:02:51 +02:00
|
|
|
void setFileBrowserErrorCallback(const std::function<void(const std::string&)> &callback);
|
2023-10-04 12:00:32 +02:00
|
|
|
bool openFileBrowser(DialogMode mode, const std::vector<ItemFilter> &validExtensions, const std::function<void(std::fs::path)> &callback, const std::string &defaultPath = {}, bool multiple = false);
|
2022-03-04 11:36:37 +01:00
|
|
|
|
2023-05-21 13:21:53 +02:00
|
|
|
void openFileExternal(const std::fs::path &filePath);
|
|
|
|
void openFolderExternal(const std::fs::path &dirPath);
|
|
|
|
void openFolderWithSelectionExternal(const std::fs::path &selectedFilePath);
|
|
|
|
|
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
|
|
|
|
|
|
|
}
|