mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-24 05:25:12 +00:00
GUI: only open file if able to save
This commit is contained in:
parent
6d2aa8d23e
commit
8c7e58b3d5
1 changed files with 6 additions and 6 deletions
|
@ -2576,11 +2576,6 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
#define FURNACE_ZLIB_COMPRESS
|
||||
|
||||
int FurnaceGUI::save(String path) {
|
||||
FILE* outFile=fopen(path.c_str(),"wb");
|
||||
if (outFile==NULL) {
|
||||
lastError=strerror(errno);
|
||||
return 1;
|
||||
}
|
||||
SafeWriter* w;
|
||||
if (path.rfind(".dmf")==path.size()-4) {
|
||||
w=e->saveDMF();
|
||||
|
@ -2589,9 +2584,14 @@ int FurnaceGUI::save(String path) {
|
|||
}
|
||||
if (w==NULL) {
|
||||
lastError=e->getLastError();
|
||||
fclose(outFile);
|
||||
return 3;
|
||||
}
|
||||
FILE* outFile=fopen(path.c_str(),"wb");
|
||||
if (outFile==NULL) {
|
||||
lastError=strerror(errno);
|
||||
w->finish();
|
||||
return 1;
|
||||
}
|
||||
#ifdef FURNACE_ZLIB_COMPRESS
|
||||
unsigned char zbuf[131072];
|
||||
int ret;
|
||||
|
|
Loading…
Reference in a new issue