New CMAKE bundle option
on behalf of L.Jirkovsky, see issue 184
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
|
||||
// This file is for your program, I won't touch it again!
|
||||
|
||||
//#include <config.h>
|
||||
#include <config.h>
|
||||
#include <gtkmm.h>
|
||||
#include <giomm.h>
|
||||
#include <iostream>
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "version.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <config.h>
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
@@ -47,6 +46,8 @@ extern Options options;
|
||||
|
||||
// stores path to data files
|
||||
Glib::ustring argv0;
|
||||
Glib::ustring creditsPath;
|
||||
Glib::ustring licensePath;
|
||||
Glib::ustring argv1;
|
||||
bool simpleEditor;
|
||||
|
||||
@@ -60,34 +61,43 @@ bool simpleEditor;
|
||||
int processLineParams( int argc, char **argv );
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
Glib::ustring argv0_;
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
WCHAR exnameU[512] = {0};
|
||||
char exname[512] = {0};
|
||||
GetModuleFileNameW (NULL, exnameU, 512);
|
||||
WideCharToMultiByte(CP_UTF8,0,exnameU,-1,exname,512,0,0 );
|
||||
argv0_ = exname;
|
||||
|
||||
// get the path where the rawtherapee executable is stored
|
||||
argv0 = Glib::path_get_dirname(argv0_);
|
||||
{
|
||||
#ifdef BUILD_BUNDLE
|
||||
char exname[512] = {0};
|
||||
Glib::ustring exePath;
|
||||
// get the path where the rawtherapee executable is stored
|
||||
#ifdef WIN32
|
||||
WCHAR exnameU[512] = {0};
|
||||
GetModuleFileNameW (NULL, exnameU, 512);
|
||||
WideCharToMultiByte(CP_UTF8,0,exnameU,-1,exname,512,0,0 );
|
||||
#else
|
||||
if (readlink("/proc/self/exe", exname, 512) < 0) {
|
||||
strncpy(exname, argv[0], 512);
|
||||
}
|
||||
#endif
|
||||
exePath = Glib::path_get_dirname(exname);
|
||||
|
||||
// set paths
|
||||
if (Glib::path_is_absolute(DATA_SEARCH_PATH)) {
|
||||
argv0 = DATA_SEARCH_PATH;
|
||||
} else {
|
||||
argv0 = Glib::build_filename(exePath, DATA_SEARCH_PATH);
|
||||
}
|
||||
if (Glib::path_is_absolute(CREDITS_SEARCH_PATH)) {
|
||||
creditsPath = CREDITS_SEARCH_PATH;
|
||||
} else {
|
||||
creditsPath = Glib::build_filename(exePath, CREDITS_SEARCH_PATH);
|
||||
}
|
||||
if (Glib::path_is_absolute(LICENCE_SEARCH_PATH)) {
|
||||
licensePath = LICENCE_SEARCH_PATH;
|
||||
} else {
|
||||
licensePath = Glib::build_filename(exePath, LICENCE_SEARCH_PATH);
|
||||
}
|
||||
#else
|
||||
// get the path to data (defined in config.h which is generated by cmake)
|
||||
argv0 = DATA_SEARCH_PATH;
|
||||
// check if path exists, otherwise revert back to behavior similar to windows
|
||||
try {
|
||||
Glib::Dir dir(DATA_SEARCH_PATH);
|
||||
} catch (Glib::FileError) {
|
||||
argv0_ = argv[0];
|
||||
argv0 = Glib::path_get_dirname(argv0_);
|
||||
}
|
||||
argv0 = DATA_SEARCH_PATH;
|
||||
creditsPath = CREDITS_SEARCH_PATH;
|
||||
licensePath = LICENCE_SEARCH_PATH;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Glib::thread_init();
|
||||
gdk_threads_init();
|
||||
@@ -127,16 +137,16 @@ int main(int argc, char **argv)
|
||||
}
|
||||
Gtk::Main m(&argc, &argv);
|
||||
|
||||
#ifndef WIN32
|
||||
// For an unknown reason, gtkmm 2.22 don't know the gtk-button-images property, while it exists in the documentation...
|
||||
// Anyway, the problem was Linux only
|
||||
static Glib::RefPtr<Gtk::Settings> settings = Gtk::Settings::get_default();
|
||||
if (settings)
|
||||
settings->property_gtk_button_images().set_value(true);
|
||||
else
|
||||
printf("Error: no default settings to update!\n");
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
// For an unknown reason, gtkmm 2.22 don't know the gtk-button-images property, while it exists in the documentation...
|
||||
// Anyway, the problem was Linux only
|
||||
static Glib::RefPtr<Gtk::Settings> settings = Gtk::Settings::get_default();
|
||||
if (settings)
|
||||
settings->property_gtk_button_images().set_value(true);
|
||||
else
|
||||
printf("Error: no default settings to update!\n");
|
||||
#endif
|
||||
|
||||
RTWindow *rtWindow = new class RTWindow();
|
||||
gdk_threads_enter ();
|
||||
m.run(*rtWindow);
|
||||
@@ -146,7 +156,6 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int processLineParams( int argc, char **argv )
|
||||
{
|
||||
std::vector<Glib::ustring> inputFiles;
|
||||
|
Reference in New Issue
Block a user