mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Added new feature allowing data files in the user's settings directory to override those in the default directory
It's for systems where the main data is not writable by everyone. (Unices, mainly, and potentially Windows Vista) The Windows default directory is a little out-of-the-way, in %HOME%\Application Data\Magic Set Editor\Data Maybe they should be configurable. But it also paves the way for the installer being capable of putting packages into the user's local directory. That way, users don't all have to have all the packages that the other users want. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@557 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+23
-19
@@ -25,12 +25,12 @@ String Error::what() const {
|
||||
// ----------------------------------------------------------------------------- : Parse errors
|
||||
|
||||
ScriptParseError::ScriptParseError(size_t pos, int line, const String& filename, const String& error)
|
||||
: start(pos), end(pos), line(line), filename(filename)
|
||||
, ParseError(error)
|
||||
: ParseError(error)
|
||||
, start(pos), end(pos), line(line), filename(filename)
|
||||
{}
|
||||
ScriptParseError::ScriptParseError(size_t pos, int line, const String& filename, const String& exp, const String& found)
|
||||
: start(pos), end(pos + found.size()), line(line), filename(filename)
|
||||
, ParseError(_("Expected '") + exp + _("' instead of '") + found + _("'"))
|
||||
: ParseError(_("Expected '") + exp + _("' instead of '") + found + _("'"))
|
||||
, start(pos), end(pos + found.size()), line(line), filename(filename)
|
||||
{}
|
||||
String ScriptParseError::what() const {
|
||||
return String(_("(")) << (int)start << _("): ") << Error::what();
|
||||
@@ -61,18 +61,20 @@ void show_pending_errors();
|
||||
void show_pending_warnings();
|
||||
|
||||
void handle_error(const String& e, bool allow_duplicate = true, bool now = true) {
|
||||
// Thread safety
|
||||
wxCriticalSectionLocker lock(crit_error_handling);
|
||||
// Check duplicates
|
||||
if (!allow_duplicate) {
|
||||
FOR_EACH(pe, previous_errors) {
|
||||
if (e == pe) return;
|
||||
{
|
||||
// Thread safety
|
||||
wxCriticalSectionLocker lock(crit_error_handling);
|
||||
// Check duplicates
|
||||
if (!allow_duplicate) {
|
||||
FOR_EACH(pe, previous_errors) {
|
||||
if (e == pe) return;
|
||||
}
|
||||
previous_errors.push_back(e);
|
||||
}
|
||||
previous_errors.push_back(e);
|
||||
// Only show errors in the main thread
|
||||
if (!pending_errors.empty()) pending_errors += _("\n\n");
|
||||
pending_errors += e;
|
||||
}
|
||||
// Only show errors in the main thread
|
||||
if (!pending_errors.empty()) pending_errors += _("\n\n");
|
||||
pending_errors += e;
|
||||
// show messages
|
||||
if (now && wxThread::IsMain()) {
|
||||
show_pending_warnings(); // warnings are older, show them first
|
||||
@@ -85,11 +87,13 @@ void handle_error(const Error& e, bool allow_duplicate, bool now) {
|
||||
}
|
||||
|
||||
void handle_warning(const String& w, bool now) {
|
||||
// Check duplicates
|
||||
wxCriticalSectionLocker lock(crit_error_handling);
|
||||
// Only show errors in the main thread
|
||||
if (!pending_warnings.empty()) pending_warnings += _("\n\n");
|
||||
pending_warnings += w;
|
||||
{
|
||||
// Check duplicates
|
||||
wxCriticalSectionLocker lock(crit_error_handling);
|
||||
// Only show errors in the main thread
|
||||
if (!pending_warnings.empty()) pending_warnings += _("\n\n");
|
||||
pending_warnings += w;
|
||||
}
|
||||
// show messages
|
||||
if (now && wxThread::IsMain()) {
|
||||
show_pending_errors();
|
||||
|
||||
Reference in New Issue
Block a user