1 #include <boost/filesystem/operations.hpp>
2 using namespace boost::filesystem;
5 #include "py/python.hpp"
8 #include "qui/MussaWindow.hpp"
9 #include "alg/parse_options.hpp"
10 #include "mussa_exceptions.hpp"
14 #include <QApplication>
17 #include <CoreFoundation/CoreFoundation.h>
20 std::string get_doc_dir()
23 CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
24 CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef,
25 kCFURLPOSIXPathStyle);
26 const char *pathPtr = CFStringGetCStringPtr(macPath,
27 CFStringGetSystemEncoding());
28 std::string doc_dir(pathPtr);
29 qDebug("Path = %s", pathPtr);
33 return std::string(".");
37 int main(int argc, char **argv)
41 // if we're under unix and don't have a display, see if we can still run
43 opts.useGUI = getenv("DISPLAY") != 0;
44 if (opts.useGUI == false) {
45 std::clog << "DISPLAY not set, running in console mode only" << std::endl;
48 //opts.doc_dir = get_doc_dir();
49 QApplication app(argc, argv, opts.useGUI);
50 Q_INIT_RESOURCE(icons);
51 const QIcon mussa_icon(":/icons/mussa.png");
52 app.setWindowIcon(mussa_icon);
54 initialize_mussa(opts, argc, argv);
55 if (opts.analysis == 0) {
61 if (opts.runAsPythonInterpeter) {
62 get_py().interpreter();
64 #endif /* USE_PYTHON */
66 MussaWindow win(opts.analysis);
71 } catch (mussa_error e) {
73 } catch (boost::filesystem::filesystem_error e) {
77 catch( boost::python::error_already_set ) {
81 catch (std::runtime_error e) {
84 qFatal("unrecognized exception");