Skip to content

Commit

Permalink
hacky bugfix to compensate a bug in MacOs save dialog :(
Browse files Browse the repository at this point in the history
  • Loading branch information
mlivesu committed Jan 25, 2025
1 parent 164275c commit 3f3f214
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/cinolib/gl/file_dialog_save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <cinolib/gl/file_dialog_save.h>
#include <cstdio>
#include <cstring>
#include <cinolib/string_utilities.h>

#ifdef _WIN32
#include <windows.h>
Expand Down Expand Up @@ -78,6 +79,17 @@ std::string file_dialog_save()
// File name too long, buffer has been filled, so we return empty string instead
buffer[0] = '\0';
}

// This fixes a weird bug in the MacOS save dialog for which if I
// want to save a mesh in .mesh format, the string that I get is
// "path/filename.mesh.m" instead of "path/filename.mesh"
std::string str(buffer);
if(get_file_extension(str).compare(".m"))
{
str.pop_back();
str.pop_back();
return str;
}
}

#elif defined _WIN32
Expand Down

0 comments on commit 3f3f214

Please sign in to comment.