Skip to content
This repository has been archived by the owner on Dec 3, 2020. It is now read-only.

Commit

Permalink
Fix bug when pressing cancel on save dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Mar 5, 2015
1 parent 0e68f5e commit 0df5c41
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions src/dialogs/FileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,18 @@ void FileDialog_save_project(EditorState *state)
state->isInstalled);

const char* filters[] = {"*.nbe"};
std::string file = tinyfd_saveFileDialog("Save Project", path.c_str(),
const char *cfile = tinyfd_saveFileDialog("Save Project", path.c_str(),
1, filters);
std::cerr << file << std::endl;

if (!cfile)
return;

std::string file = cfile;

if (file == "")
return;

std::cerr << file << std::endl;

FileFormat *writer = getFromType(FILE_FORMAT_NBE, state);
save_file(writer, state, file);
Expand All @@ -173,13 +179,19 @@ void FileDialog_export(EditorState *state, int parser)
else if (parser == (int)FILE_FORMAT_CPP)
filters[0] = "*.cpp";

std::string file = tinyfd_saveFileDialog("Save Project", path.c_str(),
const char *cfile = tinyfd_saveFileDialog("Save Project", path.c_str(),
1, filters);
std::cerr << file << std::endl;

if (!cfile)
return;

std::string file = cfile;

if (file == "")
return;

std::cerr << file << std::endl;

FileFormat *writer = getFromType((FileFormatType)parser, state);
save_file(writer, state, file);
}
Expand All @@ -195,8 +207,14 @@ void FileDialog_export_obj(EditorState *state, Node *node)

const char* filters[] = {"*.obj"};

std::string filename = tinyfd_saveFileDialog("Export Node to Mesh", path.c_str(),
1, filters);
const char *cfile = tinyfd_saveFileDialog("Export Node to Mesh", path.c_str(),
1, filters);

if (!cfile)
return;

std::string filename = cfile;

if (filename == "")
return;

Expand Down

0 comments on commit 0df5c41

Please sign in to comment.