diff --git a/qelectrotech.pro b/qelectrotech.pro index 4a005d01d..b8ffde2b6 100644 --- a/qelectrotech.pro +++ b/qelectrotech.pro @@ -30,7 +30,7 @@ win32 { } macx { # Chemins MacOS X - COMPIL_PREFIX = '/usr/local/' + COMPIL_PREFIX = '' INSTALL_PREFIX = '/usr/local/' QET_BINARY_PATH = 'bin/' QET_COMMON_COLLECTION_PATH = 'share/qelectrotech/elements/' @@ -309,7 +309,7 @@ unix { INSTALLS += desktop mime_xml mime_desktop mime_package icons man examples } -# Options de compilation propres a Unix +# Options de compilation communes a Unix et MacOS X unix { # Chemin des fichiers de traduction ; par defaut : lang/ dans le repertoire d'execution DEFINES += QET_LANG_PATH=$$join(COMPIL_PREFIX,,,$${QET_LANG_PATH}) @@ -317,3 +317,10 @@ unix { # Chemin de la collection commune ; par defaut : elements/ dans le repertoire d'execution DEFINES += QET_COMMON_COLLECTION_PATH=$$join(COMPIL_PREFIX,,,$${QET_COMMON_COLLECTION_PATH}) } + +# Options de compilation specifiques a MacOS X +macx { + # les chemins definis precedemment sont relatifs au dossier contenant le binaire executable + DEFINES += QET_LANG_PATH_RELATIVE_TO_BINARY_PATH + DEFINES += QET_COMMON_COLLECTION_PATH_RELATIVE_TO_BINARY_PATH +} diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index a2cea9a6b..4099a31dd 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -264,10 +264,17 @@ QString QETApp::commonElementsDir() { #ifdef QET_ALLOW_OVERRIDE_CED_OPTION if (common_elements_dir != QString()) return(common_elements_dir); #endif -#ifdef QET_COMMON_COLLECTION_PATH - return(QUOTE(QET_COMMON_COLLECTION_PATH)); -#else +#ifndef QET_COMMON_COLLECTION_PATH + // en l'absence d'option de compilation, on utilise le dossier elements, situe a cote du binaire executable return(QCoreApplication::applicationDirPath() + "/elements/"); +#else + #ifndef QET_COMMON_COLLECTION_PATH_RELATIVE_TO_BINARY_PATH + // l'option de compilation represente un chemin absolu ou relatif classique + return(QUOTE(QET_COMMON_COLLECTION_PATH)); + #else + // l'option de compilation represente un chemin relatif au dossier contenant le binaire executable + return(QCoreApplication::applicationDirPath() + "/" + QUOTE(QET_COMMON_COLLECTION_PATH))); + #endif #endif } @@ -412,9 +419,16 @@ QString QETApp::languagesPath() { return(lang_dir); } else { #ifndef QET_LANG_PATH + // en l'absence d'option de compilation, on utilise le dossier lang, situe a cote du binaire executable return(QCoreApplication::applicationDirPath() + "/lang/"); #else - return(QUOTE(QET_LANG_PATH)); + #ifndef QET_LANG_PATH_RELATIVE_TO_BINARY_PATH + // l'option de compilation represente un chemin absolu ou relatif classique + return(QUOTE(QET_LANG_PATH)); + #else + // l'option de compilation represente un chemin relatif au dossier contenant le binaire executable + return(QCoreApplication::applicationDirPath() + "/" + QUOTE(QET_LANG_PATH))); + #endif #endif } }