mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
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> git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1206 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
/* Define to 1 if you have the `floor' function. */
|
||||
#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. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ WelcomeWindow::WelcomeWindow()
|
||||
#endif
|
||||
wxControl* open_last = nullptr;
|
||||
if (!settings.recent_sets.empty()) {
|
||||
wxFileName n(settings.recent_sets.front());
|
||||
if (n.FileExists() || n.DirExists())
|
||||
if (wxFileName::FileExists(settings.recent_sets.front()) || wxFileName::DirExists(settings.recent_sets.front()+_("/")))
|
||||
#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()));
|
||||
#else
|
||||
@@ -102,7 +101,12 @@ void WelcomeWindow::onNewSet(wxCommandEvent&) {
|
||||
void WelcomeWindow::onOpenLast(wxCommandEvent&) {
|
||||
wxBusyCursor wait;
|
||||
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&) {
|
||||
|
||||
+10
-1
@@ -35,7 +35,16 @@ DECLARE_POINTER_TYPE(FunctionProfile);
|
||||
return i.QuadPart;
|
||||
}
|
||||
#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
|
||||
|
||||
/// Simple execution timer
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <util/prec.hpp>
|
||||
#include <util/prec.hpp>
|
||||
#include <util/file_utils.hpp>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/dir.h>
|
||||
@@ -84,7 +84,7 @@ bool resolve_filename_conflicts(wxFileName& fn, FilenameConflicts conflicts, set
|
||||
// ----------------------------------------------------------------------------- : Directories
|
||||
|
||||
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 = file.find_first_of(_("\\/"),pos+1)) {
|
||||
String part = file.substr(0,pos);
|
||||
|
||||
@@ -31,6 +31,10 @@ PackageManager package_manager;
|
||||
void PackageManager::init() {
|
||||
local.init(true);
|
||||
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() {
|
||||
loaded_packages.clear();
|
||||
@@ -186,15 +190,19 @@ void PackageDirectory::init(bool local) {
|
||||
String d = dir;
|
||||
dir = wxPathOnly(dir);
|
||||
if (d == dir) {
|
||||
// we are at the root -> 'data' not found anywhere in the path -> fatal error
|
||||
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());
|
||||
// we are at the root -> 'data' not found anywhere in the path
|
||||
dir = wxStandardPaths::Get().GetDataDir();
|
||||
break;
|
||||
}
|
||||
}
|
||||
init(dir + _("/data"));
|
||||
}
|
||||
}
|
||||
void PackageDirectory::init(const String& dir) {
|
||||
directory = dir;
|
||||
if (wxDirExists(dir))
|
||||
directory = dir;
|
||||
else
|
||||
directory.clear();
|
||||
}
|
||||
|
||||
String PackageDirectory::name(const String& name) const {
|
||||
|
||||
@@ -63,6 +63,8 @@ class PackageDirectory {
|
||||
void init(bool local);
|
||||
void init(const String& dir);
|
||||
|
||||
bool valid() const { return !directory.empty(); }
|
||||
|
||||
/// Name of a package in this directory
|
||||
String name(const String& name) const;
|
||||
/// Does a package with the given name exist?
|
||||
|
||||
Reference in New Issue
Block a user