1 #include <boost/filesystem/operations.hpp>
2 using namespace boost::filesystem;
4 #include "py/python.hpp"
5 #include "qui/MussaWindow.hpp"
6 #include "alg/parse_options.hpp"
7 #include "mussa_exceptions.hpp"
11 #include <QApplication>
14 #include <CoreFoundation/CoreFoundation.h>
17 std::string get_doc_dir()
20 CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
21 CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef,
22 kCFURLPOSIXPathStyle);
23 const char *pathPtr = CFStringGetCStringPtr(macPath,
24 CFStringGetSystemEncoding());
25 std::string doc_dir(pathPtr);
26 qDebug("Path = %s", pathPtr);
30 return std::string(".");
34 int main(int argc, char **argv)
38 // if we're under unix and don't have a display, see if we can still run
40 opts.useGUI = getenv("DISPLAY") != 0;
41 if (opts.useGUI == false) {
42 std::clog << "DISPLAY not set, running in console mode only" << std::endl;
45 //opts.doc_dir = get_doc_dir();
46 QApplication app(argc, argv, opts.useGUI);
47 Q_INIT_RESOURCE(icons);
49 initialize_mussa(opts, argc, argv);
51 if (opts.analysis == 0) {
57 if (opts.runAsPythonInterpeter) {
58 get_py().interpreter();
60 #endif /* USE_PYTHON */
62 MussaWindow win(opts.analysis);
67 } catch (mussa_error e) {
69 } catch (boost::filesystem::filesystem_error e) {
71 } catch( boost::python::error_already_set ) {
73 } catch (std::runtime_error e) {
76 qFatal("unrecognized exception");