Fixed windows build

This commit is contained in:
Yousef Khadadeh 2026-04-11 11:17:26 +03:00
parent f78db24f49
commit da1a1c26cb
7 changed files with 11 additions and 11 deletions

View file

@ -48,7 +48,7 @@ std::string read_file_to_string(const std::filesystem::path& filePath) {
// Could also use SDL_LoadFile, but that allocates into a void* and involves a copy into std::string
std::string toRet;
SDL_IOStream* file = SDL_IOFromFile(filePath.c_str(), "rb");
SDL_IOStream* file = SDL_IOFromFile(filePath.string().c_str(), "rb");
if(!file)
throw std::runtime_error("[read_file_to_string] Could not open file " + filePath.string());
Sint64 fileSize = SDL_GetIOSize(file);

View file

@ -70,7 +70,7 @@ void ImageEditTool::edit_gui() {
);
#endif
t.open_file_selector("Download File", {{"Any File", "*"}}, [resourceData](const std::filesystem::path& p, const auto& e) {
SDL_SaveFile(p.c_str(), resourceData->data->c_str(), resourceData->data->size());
SDL_SaveFile(p.string().c_str(), resourceData->data->c_str(), resourceData->data->size());
}, resourceData->name, true);
}
});

View file

@ -352,7 +352,7 @@ void ScreenshotTool::take_screenshot(const std::filesystem::path& filePath, Scre
#ifndef __EMSCRIPTEN__
try {
auto skData = out.detachAsData();
if(!SDL_SaveFile(filePath.c_str(), skData->bytes(), skData->size()))
if(!SDL_SaveFile(filePath.string().c_str(), skData->bytes(), skData->size()))
throw std::runtime_error("SDL_SaveFile failed with error: " + std::string(SDL_GetError()));
}
catch(const std::exception& e) {
@ -382,7 +382,7 @@ void ScreenshotTool::take_screenshot(const std::filesystem::path& filePath, Scre
#ifndef __EMSCRIPTEN__
try {
auto skData = out.detachAsData();
if(!SDL_SaveFile(filePath.c_str(), skData->bytes(), skData->size()))
if(!SDL_SaveFile(filePath.string().c_str(), skData->bytes(), skData->size()))
throw std::runtime_error("SDL_SaveFile failed with error: " + std::string(SDL_GetError()));
}
catch(const std::exception& e) {

View file

@ -28,12 +28,12 @@ GUIHolder::GUIHolder(MainProgram& m):
void GUIHolder::load_icons_at(const std::filesystem::path& pathToLoad) {
int globCount;
char** filesInPath = SDL_GlobDirectory(pathToLoad.c_str(), nullptr, 0, &globCount);
char** filesInPath = SDL_GlobDirectory(pathToLoad.string().c_str(), nullptr, 0, &globCount);
if(filesInPath) {
for(int i = 0; i < globCount; i++) {
std::filesystem::path filePath = pathToLoad / std::filesystem::path(filesInPath[i]);
SDL_PathInfo fileInfo;
if(SDL_GetPathInfo(filePath.c_str(), &fileInfo) && fileInfo.type == SDL_PATHTYPE_FILE) {
if(SDL_GetPathInfo(filePath.string().c_str(), &fileInfo) && fileInfo.type == SDL_PATHTYPE_FILE) {
std::string iconRelativePath = filePath.relative_path().string();
std::replace(iconRelativePath.begin(), iconRelativePath.end(), '\\', '/');
std::string iconData = read_file_to_string(iconRelativePath);

View file

@ -220,12 +220,12 @@ void Toolbar::load_licenses() {
{
int globCount;
std::filesystem::path third_party_license_path("data/third_party_licenses");
char** filesInPath = SDL_GlobDirectory(third_party_license_path.c_str(), nullptr, 0, &globCount);
char** filesInPath = SDL_GlobDirectory(third_party_license_path.string().c_str(), nullptr, 0, &globCount);
if(filesInPath) {
for(int i = 0; i < globCount; i++) {
std::filesystem::path filePath = third_party_license_path / std::filesystem::path(filesInPath[i]);
SDL_PathInfo fileInfo;
if(SDL_GetPathInfo(filePath.c_str(), &fileInfo) && fileInfo.type == SDL_PATHTYPE_FILE) {
if(SDL_GetPathInfo(filePath.string().c_str(), &fileInfo) && fileInfo.type == SDL_PATHTYPE_FILE) {
thirdPartyLicenses.emplace_back(filePath.filename().string(), read_file_to_string(filePath));
}
}
@ -1837,7 +1837,7 @@ void Toolbar::general_settings_inner_gui() {
slider_scalar_field(gui, "tablet brush minimum size", "Brush relative minimum size", &main.conf.tabletOptions.brushMinimumSize, 0.0f, 1.0f, {.decimalPrecision = 3});
checkbox_boolean_field(gui, "tablet zoom with button method", "Zoom when pen touching tablet and pen button assigned to middle click is held", &main.conf.tabletOptions.zoomWhilePenDownAndButtonHeld);
#ifdef _WIN32
checkbox_boolean_field(gui, "mouse ignore when pen proximity", "Ignore mouse movement when pen in proximity", &tabletOptions.ignoreMouseMovementWhenPenInProximity);
checkbox_boolean_field(gui, "mouse ignore when pen proximity", "Ignore mouse movement when pen in proximity", &main.conf.tabletOptions.ignoreMouseMovementWhenPenInProximity);
#endif
});
break;

View file

@ -469,7 +469,7 @@ void World::save_to_file(const std::filesystem::path& filePathToSaveAt) {
f.view()
);
#else
if(!SDL_SaveFile(filePath.c_str(), f.view().data(), f.view().size()))
if(!SDL_SaveFile(filePath.string().c_str(), f.view().data(), f.view().size()))
throw std::runtime_error("SDL_SaveFile failed with error: " + std::string(SDL_GetError()));
#endif

View file

@ -704,7 +704,7 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
break;
case SDL_EVENT_MOUSE_MOTION:
#ifdef _WIN32
if(!mS.m->toolbar.tabletOptions.ignoreMouseMovementWhenPenInProximity || !mS.m->input.pen.inProximity)
if(!mS.m->conf.tabletOptions.ignoreMouseMovementWhenPenInProximity || !mS.m->input.pen.inProximity)
#endif
{
mS.m->input.backend_mouse_motion_update(event->motion);