fix: define PROGRAM_DATA_DIR for cmake

* the PROGRAM_DATA_DIR is hardcoded path to /usr/share/goldendict
* Without it, resources cannot be loaded
This commit is contained in:
shenleban tongying 2023-06-03 09:50:13 -04:00
parent 87e2091214
commit 849b1345e1
No known key found for this signature in database
2 changed files with 6 additions and 1 deletions

View file

@ -95,6 +95,11 @@ endif ()
# Note: used as c++ string thus need surrounding " " # Note: used as c++ string thus need surrounding " "
add_compile_definitions(PROGRAM_VERSION="${PROJECT_VERSION}") add_compile_definitions(PROGRAM_VERSION="${PROJECT_VERSION}")
if (LINUX)
# see: config.cc -> getProgramDataDir
add_compile_definitions(PROGRAM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/goldendict")
endif ()
target_link_libraries(${GOLDENDICT} PRIVATE target_link_libraries(${GOLDENDICT} PRIVATE
Qt6::Xml Qt6::Xml
Qt6::Concurrent Qt6::Concurrent

View file

@ -2276,7 +2276,7 @@ QString getProgramDataDir() noexcept
{ {
if ( isPortableVersion() ) if ( isPortableVersion() )
return QCoreApplication::applicationDirPath(); return QCoreApplication::applicationDirPath();
// TODO: rewrite this in QStandardPaths::AppDataLocation
#ifdef PROGRAM_DATA_DIR #ifdef PROGRAM_DATA_DIR
return PROGRAM_DATA_DIR; return PROGRAM_DATA_DIR;
#else #else