Fixed windows build
This commit is contained in:
parent
f78db24f49
commit
da1a1c26cb
7 changed files with 11 additions and 11 deletions
|
|
@ -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
|
// Could also use SDL_LoadFile, but that allocates into a void* and involves a copy into std::string
|
||||||
|
|
||||||
std::string toRet;
|
std::string toRet;
|
||||||
SDL_IOStream* file = SDL_IOFromFile(filePath.c_str(), "rb");
|
SDL_IOStream* file = SDL_IOFromFile(filePath.string().c_str(), "rb");
|
||||||
if(!file)
|
if(!file)
|
||||||
throw std::runtime_error("[read_file_to_string] Could not open file " + filePath.string());
|
throw std::runtime_error("[read_file_to_string] Could not open file " + filePath.string());
|
||||||
Sint64 fileSize = SDL_GetIOSize(file);
|
Sint64 fileSize = SDL_GetIOSize(file);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ void ImageEditTool::edit_gui() {
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
t.open_file_selector("Download File", {{"Any File", "*"}}, [resourceData](const std::filesystem::path& p, const auto& e) {
|
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);
|
}, resourceData->name, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ void ScreenshotTool::take_screenshot(const std::filesystem::path& filePath, Scre
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
try {
|
try {
|
||||||
auto skData = out.detachAsData();
|
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()));
|
throw std::runtime_error("SDL_SaveFile failed with error: " + std::string(SDL_GetError()));
|
||||||
}
|
}
|
||||||
catch(const std::exception& e) {
|
catch(const std::exception& e) {
|
||||||
|
|
@ -382,7 +382,7 @@ void ScreenshotTool::take_screenshot(const std::filesystem::path& filePath, Scre
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
try {
|
try {
|
||||||
auto skData = out.detachAsData();
|
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()));
|
throw std::runtime_error("SDL_SaveFile failed with error: " + std::string(SDL_GetError()));
|
||||||
}
|
}
|
||||||
catch(const std::exception& e) {
|
catch(const std::exception& e) {
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,12 @@ GUIHolder::GUIHolder(MainProgram& m):
|
||||||
|
|
||||||
void GUIHolder::load_icons_at(const std::filesystem::path& pathToLoad) {
|
void GUIHolder::load_icons_at(const std::filesystem::path& pathToLoad) {
|
||||||
int globCount;
|
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) {
|
if(filesInPath) {
|
||||||
for(int i = 0; i < globCount; i++) {
|
for(int i = 0; i < globCount; i++) {
|
||||||
std::filesystem::path filePath = pathToLoad / std::filesystem::path(filesInPath[i]);
|
std::filesystem::path filePath = pathToLoad / std::filesystem::path(filesInPath[i]);
|
||||||
SDL_PathInfo fileInfo;
|
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::string iconRelativePath = filePath.relative_path().string();
|
||||||
std::replace(iconRelativePath.begin(), iconRelativePath.end(), '\\', '/');
|
std::replace(iconRelativePath.begin(), iconRelativePath.end(), '\\', '/');
|
||||||
std::string iconData = read_file_to_string(iconRelativePath);
|
std::string iconData = read_file_to_string(iconRelativePath);
|
||||||
|
|
|
||||||
|
|
@ -220,12 +220,12 @@ void Toolbar::load_licenses() {
|
||||||
{
|
{
|
||||||
int globCount;
|
int globCount;
|
||||||
std::filesystem::path third_party_license_path("data/third_party_licenses");
|
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) {
|
if(filesInPath) {
|
||||||
for(int i = 0; i < globCount; i++) {
|
for(int i = 0; i < globCount; i++) {
|
||||||
std::filesystem::path filePath = third_party_license_path / std::filesystem::path(filesInPath[i]);
|
std::filesystem::path filePath = third_party_license_path / std::filesystem::path(filesInPath[i]);
|
||||||
SDL_PathInfo fileInfo;
|
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));
|
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});
|
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);
|
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
|
#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
|
#endif
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,7 @@ void World::save_to_file(const std::filesystem::path& filePathToSaveAt) {
|
||||||
f.view()
|
f.view()
|
||||||
);
|
);
|
||||||
#else
|
#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()));
|
throw std::runtime_error("SDL_SaveFile failed with error: " + std::string(SDL_GetError()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -704,7 +704,7 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_MOUSE_MOTION:
|
case SDL_EVENT_MOUSE_MOTION:
|
||||||
#ifdef _WIN32
|
#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
|
#endif
|
||||||
{
|
{
|
||||||
mS.m->input.backend_mouse_motion_update(event->motion);
|
mS.m->input.backend_mouse_motion_update(event->motion);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue