Commit eb7c0af4 authored by coppro's avatar coppro

Updates to make things work.

Some trivial things that are required to make it work on Linux.
Also updated build scripts to use Boost. You have to use
./configure --with-boost-regex=<libname, suitable for -l>
parent d100ba4d
...@@ -12,8 +12,8 @@ echo " ...@@ -12,8 +12,8 @@ echo "
AUTOMAKE_OPTIONS = subdir-objects AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = magicseteditor bin_PROGRAMS = magicseteditor
AM_CXXFLAGS = @WX_CXXFLAGS@ -DUNICODE -I . -Wall AM_CXXFLAGS = @WX_CXXFLAGS@ \$(BOOST_CXXFLAGS) -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@ AM_LDFLAGS = @WX_LIBS@ \$(BOOST_LDFLAGS) \$(BOOST_REGEX_LIB)
magicseteditor_SOURCES = magicseteditor_SOURCES =
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
AUTOMAKE_OPTIONS = subdir-objects AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = magicseteditor bin_PROGRAMS = magicseteditor
AM_CXXFLAGS = @WX_CXXFLAGS@ -DUNICODE -I . -Wall AM_CXXFLAGS = @WX_CXXFLAGS@ $(BOOST_CXXFLAGS) -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@ AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS) $(BOOST_REGEX_LIB)
magicseteditor_SOURCES = magicseteditor_SOURCES =
...@@ -21,6 +21,7 @@ magicseteditor_SOURCES += ./src/util/version.cpp ...@@ -21,6 +21,7 @@ magicseteditor_SOURCES += ./src/util/version.cpp
magicseteditor_SOURCES += ./src/util/alignment.cpp magicseteditor_SOURCES += ./src/util/alignment.cpp
magicseteditor_SOURCES += ./src/util/rotation.cpp magicseteditor_SOURCES += ./src/util/rotation.cpp
magicseteditor_SOURCES += ./src/util/tagged_string.cpp magicseteditor_SOURCES += ./src/util/tagged_string.cpp
magicseteditor_SOURCES += ./src/util/regex.cpp
magicseteditor_SOURCES += ./src/util/spec_sort.cpp magicseteditor_SOURCES += ./src/util/spec_sort.cpp
magicseteditor_SOURCES += ./src/util/io/get_member.cpp magicseteditor_SOURCES += ./src/util/io/get_member.cpp
magicseteditor_SOURCES += ./src/util/io/package_manager.cpp magicseteditor_SOURCES += ./src/util/io/package_manager.cpp
...@@ -62,6 +63,7 @@ magicseteditor_SOURCES += ./src/render/value/information.cpp ...@@ -62,6 +63,7 @@ magicseteditor_SOURCES += ./src/render/value/information.cpp
magicseteditor_SOURCES += ./src/render/value/choice.cpp magicseteditor_SOURCES += ./src/render/value/choice.cpp
magicseteditor_SOURCES += ./src/render/value/image.cpp magicseteditor_SOURCES += ./src/render/value/image.cpp
magicseteditor_SOURCES += ./src/script/scriptable.cpp magicseteditor_SOURCES += ./src/script/scriptable.cpp
magicseteditor_SOURCES += ./src/script/profiler.cpp
magicseteditor_SOURCES += ./src/script/script_manager.cpp magicseteditor_SOURCES += ./src/script/script_manager.cpp
magicseteditor_SOURCES += ./src/script/functions/english.cpp magicseteditor_SOURCES += ./src/script/functions/english.cpp
magicseteditor_SOURCES += ./src/script/functions/basic.cpp magicseteditor_SOURCES += ./src/script/functions/basic.cpp
......
...@@ -59,7 +59,7 @@ PROGRAMS = $(bin_PROGRAMS) ...@@ -59,7 +59,7 @@ PROGRAMS = $(bin_PROGRAMS)
am__dirstamp = $(am__leading_dot)dirstamp am__dirstamp = $(am__leading_dot)dirstamp
am_magicseteditor_OBJECTS = ./src/util/version.$(OBJEXT) \ am_magicseteditor_OBJECTS = ./src/util/version.$(OBJEXT) \
./src/util/alignment.$(OBJEXT) ./src/util/rotation.$(OBJEXT) \ ./src/util/alignment.$(OBJEXT) ./src/util/rotation.$(OBJEXT) \
./src/util/tagged_string.$(OBJEXT) \ ./src/util/tagged_string.$(OBJEXT) ./src/util/regex.$(OBJEXT) \
./src/util/spec_sort.$(OBJEXT) \ ./src/util/spec_sort.$(OBJEXT) \
./src/util/io/get_member.$(OBJEXT) \ ./src/util/io/get_member.$(OBJEXT) \
./src/util/io/package_manager.$(OBJEXT) \ ./src/util/io/package_manager.$(OBJEXT) \
...@@ -95,6 +95,7 @@ am_magicseteditor_OBJECTS = ./src/util/version.$(OBJEXT) \ ...@@ -95,6 +95,7 @@ am_magicseteditor_OBJECTS = ./src/util/version.$(OBJEXT) \
./src/render/value/choice.$(OBJEXT) \ ./src/render/value/choice.$(OBJEXT) \
./src/render/value/image.$(OBJEXT) \ ./src/render/value/image.$(OBJEXT) \
./src/script/scriptable.$(OBJEXT) \ ./src/script/scriptable.$(OBJEXT) \
./src/script/profiler.$(OBJEXT) \
./src/script/script_manager.$(OBJEXT) \ ./src/script/script_manager.$(OBJEXT) \
./src/script/functions/english.$(OBJEXT) \ ./src/script/functions/english.$(OBJEXT) \
./src/script/functions/basic.$(OBJEXT) \ ./src/script/functions/basic.$(OBJEXT) \
...@@ -232,6 +233,9 @@ AUTOCONF = @AUTOCONF@ ...@@ -232,6 +233,9 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@ AWK = @AWK@
BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
BOOST_LDFLAGS = @BOOST_LDFLAGS@
BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
CC = @CC@ CC = @CC@
CCDEPMODE = @CCDEPMODE@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
...@@ -327,35 +331,37 @@ top_srcdir = @top_srcdir@ ...@@ -327,35 +331,37 @@ top_srcdir = @top_srcdir@
# This flag allows us to use subdirectories: # This flag allows us to use subdirectories:
AUTOMAKE_OPTIONS = subdir-objects AUTOMAKE_OPTIONS = subdir-objects
AM_CXXFLAGS = @WX_CXXFLAGS@ -DUNICODE -I . -Wall AM_CXXFLAGS = @WX_CXXFLAGS@ $(BOOST_CXXFLAGS) -DUNICODE -I . -Wall
AM_LDFLAGS = @WX_LIBS@ AM_LDFLAGS = @WX_LIBS@ $(BOOST_LDFLAGS) $(BOOST_REGEX_LIB)
# The script used to generate is MakeAM.sh # The script used to generate is MakeAM.sh
magicseteditor_SOURCES = ./src/util/version.cpp \ magicseteditor_SOURCES = ./src/util/version.cpp \
./src/util/alignment.cpp ./src/util/rotation.cpp \ ./src/util/alignment.cpp ./src/util/rotation.cpp \
./src/util/tagged_string.cpp ./src/util/spec_sort.cpp \ ./src/util/tagged_string.cpp ./src/util/regex.cpp \
./src/util/io/get_member.cpp ./src/util/io/package_manager.cpp \ ./src/util/spec_sort.cpp ./src/util/io/get_member.cpp \
./src/util/io/writer.cpp ./src/util/io/reader.cpp \ ./src/util/io/package_manager.cpp ./src/util/io/writer.cpp \
./src/util/io/package.cpp ./src/util/action_stack.cpp \ ./src/util/io/reader.cpp ./src/util/io/package.cpp \
./src/util/error.cpp ./src/util/age.cpp \ ./src/util/action_stack.cpp ./src/util/error.cpp \
./src/util/file_utils.cpp ./src/util/string.cpp \ ./src/util/age.cpp ./src/util/file_utils.cpp \
./src/gfx/color.cpp ./src/gfx/mask_image.cpp \ ./src/util/string.cpp ./src/gfx/color.cpp \
./src/gfx/rotate_image.cpp ./src/gfx/image_effects.cpp \ ./src/gfx/mask_image.cpp ./src/gfx/rotate_image.cpp \
./src/gfx/resample_text.cpp ./src/gfx/combine_image.cpp \ ./src/gfx/image_effects.cpp ./src/gfx/resample_text.cpp \
./src/gfx/polynomial.cpp ./src/gfx/bezier.cpp \ ./src/gfx/combine_image.cpp ./src/gfx/polynomial.cpp \
./src/gfx/generated_image.cpp ./src/gfx/resample_image.cpp \ ./src/gfx/bezier.cpp ./src/gfx/generated_image.cpp \
./src/gfx/blend_image.cpp ./src/main.cpp \ ./src/gfx/resample_image.cpp ./src/gfx/blend_image.cpp \
./src/render/card/viewer.cpp ./src/render/text/compound.cpp \ ./src/main.cpp ./src/render/card/viewer.cpp \
./src/render/text/symbol.cpp ./src/render/text/font.cpp \ ./src/render/text/compound.cpp ./src/render/text/symbol.cpp \
./src/render/text/viewer.cpp ./src/render/text/element.cpp \ ./src/render/text/font.cpp ./src/render/text/viewer.cpp \
./src/render/symbol/filter.cpp ./src/render/symbol/viewer.cpp \ ./src/render/text/element.cpp ./src/render/symbol/filter.cpp \
./src/render/symbol/viewer.cpp \
./src/render/value/multiple_choice.cpp \ ./src/render/value/multiple_choice.cpp \
./src/render/value/symbol.cpp ./src/render/value/color.cpp \ ./src/render/value/symbol.cpp ./src/render/value/color.cpp \
./src/render/value/package_choice.cpp \ ./src/render/value/package_choice.cpp \
./src/render/value/viewer.cpp ./src/render/value/text.cpp \ ./src/render/value/viewer.cpp ./src/render/value/text.cpp \
./src/render/value/information.cpp \ ./src/render/value/information.cpp \
./src/render/value/choice.cpp ./src/render/value/image.cpp \ ./src/render/value/choice.cpp ./src/render/value/image.cpp \
./src/script/scriptable.cpp ./src/script/script_manager.cpp \ ./src/script/scriptable.cpp ./src/script/profiler.cpp \
./src/script/script_manager.cpp \
./src/script/functions/english.cpp \ ./src/script/functions/english.cpp \
./src/script/functions/basic.cpp \ ./src/script/functions/basic.cpp \
./src/script/functions/construction.cpp \ ./src/script/functions/construction.cpp \
...@@ -519,6 +525,8 @@ src/util/$(DEPDIR)/$(am__dirstamp): ...@@ -519,6 +525,8 @@ src/util/$(DEPDIR)/$(am__dirstamp):
src/util/$(DEPDIR)/$(am__dirstamp) src/util/$(DEPDIR)/$(am__dirstamp)
./src/util/tagged_string.$(OBJEXT): src/util/$(am__dirstamp) \ ./src/util/tagged_string.$(OBJEXT): src/util/$(am__dirstamp) \
src/util/$(DEPDIR)/$(am__dirstamp) src/util/$(DEPDIR)/$(am__dirstamp)
./src/util/regex.$(OBJEXT): src/util/$(am__dirstamp) \
src/util/$(DEPDIR)/$(am__dirstamp)
./src/util/spec_sort.$(OBJEXT): src/util/$(am__dirstamp) \ ./src/util/spec_sort.$(OBJEXT): src/util/$(am__dirstamp) \
src/util/$(DEPDIR)/$(am__dirstamp) src/util/$(DEPDIR)/$(am__dirstamp)
src/util/io/$(am__dirstamp): src/util/io/$(am__dirstamp):
...@@ -654,6 +662,8 @@ src/script/$(DEPDIR)/$(am__dirstamp): ...@@ -654,6 +662,8 @@ src/script/$(DEPDIR)/$(am__dirstamp):
@: > src/script/$(DEPDIR)/$(am__dirstamp) @: > src/script/$(DEPDIR)/$(am__dirstamp)
./src/script/scriptable.$(OBJEXT): src/script/$(am__dirstamp) \ ./src/script/scriptable.$(OBJEXT): src/script/$(am__dirstamp) \
src/script/$(DEPDIR)/$(am__dirstamp) src/script/$(DEPDIR)/$(am__dirstamp)
./src/script/profiler.$(OBJEXT): src/script/$(am__dirstamp) \
src/script/$(DEPDIR)/$(am__dirstamp)
./src/script/script_manager.$(OBJEXT): src/script/$(am__dirstamp) \ ./src/script/script_manager.$(OBJEXT): src/script/$(am__dirstamp) \
src/script/$(DEPDIR)/$(am__dirstamp) src/script/$(DEPDIR)/$(am__dirstamp)
src/script/functions/$(am__dirstamp): src/script/functions/$(am__dirstamp):
...@@ -1139,6 +1149,7 @@ mostlyclean-compile: ...@@ -1139,6 +1149,7 @@ mostlyclean-compile:
-rm -f ./src/script/functions/regex.$(OBJEXT) -rm -f ./src/script/functions/regex.$(OBJEXT)
-rm -f ./src/script/image.$(OBJEXT) -rm -f ./src/script/image.$(OBJEXT)
-rm -f ./src/script/parser.$(OBJEXT) -rm -f ./src/script/parser.$(OBJEXT)
-rm -f ./src/script/profiler.$(OBJEXT)
-rm -f ./src/script/script.$(OBJEXT) -rm -f ./src/script/script.$(OBJEXT)
-rm -f ./src/script/script_manager.$(OBJEXT) -rm -f ./src/script/script_manager.$(OBJEXT)
-rm -f ./src/script/scriptable.$(OBJEXT) -rm -f ./src/script/scriptable.$(OBJEXT)
...@@ -1153,6 +1164,7 @@ mostlyclean-compile: ...@@ -1153,6 +1164,7 @@ mostlyclean-compile:
-rm -f ./src/util/io/package_manager.$(OBJEXT) -rm -f ./src/util/io/package_manager.$(OBJEXT)
-rm -f ./src/util/io/reader.$(OBJEXT) -rm -f ./src/util/io/reader.$(OBJEXT)
-rm -f ./src/util/io/writer.$(OBJEXT) -rm -f ./src/util/io/writer.$(OBJEXT)
-rm -f ./src/util/regex.$(OBJEXT)
-rm -f ./src/util/rotation.$(OBJEXT) -rm -f ./src/util/rotation.$(OBJEXT)
-rm -f ./src/util/spec_sort.$(OBJEXT) -rm -f ./src/util/spec_sort.$(OBJEXT)
-rm -f ./src/util/string.$(OBJEXT) -rm -f ./src/util/string.$(OBJEXT)
...@@ -1298,6 +1310,7 @@ distclean-compile: ...@@ -1298,6 +1310,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/dependency.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/dependency.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/parser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/profiler.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/script.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/script.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/script_manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/script_manager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/scriptable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/script/$(DEPDIR)/scriptable.Po@am__quote@
...@@ -1314,6 +1327,7 @@ distclean-compile: ...@@ -1314,6 +1327,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/alignment.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/alignment.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/error.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/file_utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/file_utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/regex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/rotation.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/rotation.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/spec_sort.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/spec_sort.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/string.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./src/util/$(DEPDIR)/string.Po@am__quote@
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
BASEDIR=~/.magicseteditor/resource BASEDIR=~/.magicseteditor/resource
rm -r $BASEDIR/resource rm -rf $BASEDIR
for DIR in $BASEDIR $BASEDIR/icon $BASEDIR/tool $BASEDIR/cursor for DIR in $BASEDIR $BASEDIR/icon $BASEDIR/tool $BASEDIR/cursor
do do
......
This diff is collapsed.
...@@ -18,7 +18,10 @@ AC_PROG_CXX ...@@ -18,7 +18,10 @@ AC_PROG_CXX
# Do not pass -O2, because that causes failures for now. # Do not pass -O2, because that causes failures for now.
CXXFLAGS=-g CXXFLAGS=-g
# Checks for libraries. # Checks for libraries.
# TODO: Check for boost
# Check for Boost
AX_BOOST_BASE([1.36.0])
AX_BOOST_REGEX
# Check for wxWidgets # Check for wxWidgets
AM_OPTIONS_WXCONFIG AM_OPTIONS_WXCONFIG
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
/* Define to 1 if you have the `floor' function. */ /* Define to 1 if you have the `floor' function. */
#undef HAVE_FLOOR #undef HAVE_FLOOR
/* Define if compiler provides atomic builtins */
#undef HAVE_GCC_ATOMIC_BUILTINS
/* Define to 1 if you have the <inttypes.h> header file. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
......
...@@ -47,8 +47,7 @@ WelcomeWindow::WelcomeWindow() ...@@ -47,8 +47,7 @@ WelcomeWindow::WelcomeWindow()
#endif #endif
wxControl* open_last = nullptr; wxControl* open_last = nullptr;
if (!settings.recent_sets.empty()) { if (!settings.recent_sets.empty()) {
wxFileName n(settings.recent_sets.front()); if (wxFileName::FileExists(settings.recent_sets.front()) || wxFileName::DirExists(settings.recent_sets.front()+_("/")))
if (n.FileExists() || n.DirExists())
#ifdef USE_HOVERBUTTON #ifdef USE_HOVERBUTTON
open_last = new HoverButtonExt(this, ID_FILE_RECENT, load_resource_image(_("welcome_last")), _BUTTON_("last opened set"), _HELP_1_("last opened set", n.GetName())); open_last = new HoverButtonExt(this, ID_FILE_RECENT, load_resource_image(_("welcome_last")), _BUTTON_("last opened set"), _HELP_1_("last opened set", n.GetName()));
#else #else
...@@ -102,7 +101,12 @@ void WelcomeWindow::onNewSet(wxCommandEvent&) { ...@@ -102,7 +101,12 @@ void WelcomeWindow::onNewSet(wxCommandEvent&) {
void WelcomeWindow::onOpenLast(wxCommandEvent&) { void WelcomeWindow::onOpenLast(wxCommandEvent&) {
wxBusyCursor wait; wxBusyCursor wait;
assert(!settings.recent_sets.empty()); assert(!settings.recent_sets.empty());
close( open_package<Set>(settings.recent_sets.front()) ); try {
close( open_package<Set>(settings.recent_sets.front()) );
} catch (PackageNotFoundError& e) {
handle_error(_("Cannot find package ") + e.what() + _(" to open."));
settings.recent_sets.clear();
}
} }
void WelcomeWindow::onCheckUpdates(wxCommandEvent&) { void WelcomeWindow::onCheckUpdates(wxCommandEvent&) {
......
...@@ -35,7 +35,16 @@ DECLARE_POINTER_TYPE(FunctionProfile); ...@@ -35,7 +35,16 @@ DECLARE_POINTER_TYPE(FunctionProfile);
return i.QuadPart; return i.QuadPart;
} }
#else #else
#error "No Timer implementation, can't use profiler" // clock() has nanosecond resolution on Linux
// on any other platform, stil the best way.
typedef clock_t ProfileTime;
inline ProfileTime timer_now() {
return clock();
}
inline ProfileTime timer_resolution() {
return CLOCKS_PER_SEC;
}
#endif #endif
/// Simple execution timer /// Simple execution timer
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// ----------------------------------------------------------------------------- : Includes // ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp> #include <util/prec.hpp>
#include <util/file_utils.hpp> #include <util/file_utils.hpp>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/dir.h> #include <wx/dir.h>
...@@ -84,7 +84,7 @@ bool resolve_filename_conflicts(wxFileName& fn, FilenameConflicts conflicts, set ...@@ -84,7 +84,7 @@ bool resolve_filename_conflicts(wxFileName& fn, FilenameConflicts conflicts, set
// ----------------------------------------------------------------------------- : Directories // ----------------------------------------------------------------------------- : Directories
bool create_parent_dirs(const String& file) { bool create_parent_dirs(const String& file) {
for (size_t pos = file.find_first_of(_("\\/")) ; for (size_t pos = file.find_first_of(_("\\/"), 1) ;
pos != String::npos ; pos != String::npos ;
pos = file.find_first_of(_("\\/"),pos+1)) { pos = file.find_first_of(_("\\/"),pos+1)) {
String part = file.substr(0,pos); String part = file.substr(0,pos);
......
...@@ -31,6 +31,10 @@ PackageManager package_manager; ...@@ -31,6 +31,10 @@ PackageManager package_manager;
void PackageManager::init() { void PackageManager::init() {
local.init(true); local.init(true);
global.init(false); global.init(false);
if (!(local.valid() || global.valid()))
throw Error(_("The MSE data files can not be found, there should be a directory called 'data' with these files. ")
_("The expected place to find it in was either ") + wxStandardPaths::Get().GetDataDir() + _(" or ") +
wxStandardPaths::Get().GetUserDataDir());
} }
void PackageManager::destroy() { void PackageManager::destroy() {
loaded_packages.clear(); loaded_packages.clear();
...@@ -186,15 +190,19 @@ void PackageDirectory::init(bool local) { ...@@ -186,15 +190,19 @@ void PackageDirectory::init(bool local) {
String d = dir; String d = dir;
dir = wxPathOnly(dir); dir = wxPathOnly(dir);
if (d == dir) { if (d == dir) {
// we are at the root -> 'data' not found anywhere in the path -> fatal error // we are at the root -> 'data' not found anywhere in the path
throw Error(_("The global MSE data files can not be found, there should be a directory called 'data' with these files. The expected place to find it in was ") + wxStandardPaths::Get().GetDataDir()); dir = wxStandardPaths::Get().GetDataDir();
break;
} }
} }
init(dir + _("/data")); init(dir + _("/data"));
} }
} }
void PackageDirectory::init(const String& dir) { void PackageDirectory::init(const String& dir) {
directory = dir; if (wxDirExists(dir))
directory = dir;
else
directory.clear();
} }
String PackageDirectory::name(const String& name) const { String PackageDirectory::name(const String& name) const {
......
...@@ -63,6 +63,8 @@ class PackageDirectory { ...@@ -63,6 +63,8 @@ class PackageDirectory {
void init(bool local); void init(bool local);
void init(const String& dir); void init(const String& dir);
bool valid() const { return !directory.empty(); }
/// Name of a package in this directory /// Name of a package in this directory
String name(const String& name) const; String name(const String& name) const;
/// Does a package with the given name exist? /// Does a package with the given name exist?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment