mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fix "referencing nonexistant file" bug
improve internal error message
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <util/error.hpp>
|
||||
#include <script/to_value.hpp> // for reflection
|
||||
#include <script/profiler.hpp> // for PROFILER
|
||||
#include <data/set.hpp>
|
||||
#include <wx/wfstream.h>
|
||||
#include <wx/zipstrm.h>
|
||||
#include <wx/dir.h>
|
||||
@@ -19,7 +20,7 @@
|
||||
// ----------------------------------------------------------------------------- : Package : outside
|
||||
|
||||
IMPLEMENT_DYNAMIC_ARG(Package*, writing_package, nullptr);
|
||||
IMPLEMENT_DYNAMIC_ARG(Package*, clipboard_package, nullptr);
|
||||
IMPLEMENT_DYNAMIC_ARG(Package*, clipboard_package, nullptr);
|
||||
|
||||
Package::Package()
|
||||
: zipStream (nullptr)
|
||||
@@ -97,7 +98,8 @@ void Package::save(bool remove_unused) {
|
||||
saveAs(filename, remove_unused);
|
||||
}
|
||||
|
||||
void Package::saveAs(const String& name, bool remove_unused, bool as_directory) {
|
||||
void Package::saveAs(const String& name, bool remove_unused, bool as_directory) {
|
||||
if (Set* s = dynamic_cast<Set*>(this)) s->referenceActionStackFiles();
|
||||
// type of package
|
||||
if (wxDirExists(name) || as_directory) {
|
||||
saveToDirectory(name, remove_unused, false);
|
||||
@@ -109,7 +111,8 @@ void Package::saveAs(const String& name, bool remove_unused, bool as_directory)
|
||||
reopen();
|
||||
}
|
||||
|
||||
void Package::saveCopy(const String& name) {
|
||||
void Package::saveCopy(const String& name) {
|
||||
if (Set* s = dynamic_cast<Set*>(this)) s->referenceActionStackFiles();
|
||||
saveToZipfile(name, true, true);
|
||||
clearKeepFlag();
|
||||
}
|
||||
@@ -298,7 +301,7 @@ LocalFileName Package::newFileName(const String& prefix, const String& suffix) {
|
||||
void Package::referenceFile(const String& file) {
|
||||
if (file.empty()) return;
|
||||
FileInfos::iterator it = files.find(file);
|
||||
if (it == files.end()) throw InternalError(_("referencing a nonexistant file"));
|
||||
if (it == files.end()) throw InternalError(_("Referencing an inexistant file!"));
|
||||
it->second.keep = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user