diff --git a/src/app/tape/main.cpp b/src/app/tape/main.cpp index fed0fed09..9d724774c 100644 --- a/src/app/tape/main.cpp +++ b/src/app/tape/main.cpp @@ -59,8 +59,19 @@ int main(int argc, char *argv[]) BrInitError error; if (br_init (&error)) { - exe_dir = br_find_exe_dir (nullptr); - u_setDataDirectory(exe_dir); + char *path = br_find_exe_dir(nullptr); + if (path) + { + const char* correction = "/../share/icu"; + exe_dir = static_cast (malloc(strlen(path)+strlen(correction)+1)); + if(exe_dir) + { + strcpy(exe_dir, path); + strcat(exe_dir, correction); + u_setDataDirectory(exe_dir); + } + free(path); + } } auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);}); @@ -102,7 +113,7 @@ int main(int argc, char *argv[]) #if defined(APPIMAGE) && defined(Q_OS_LINUX) if (exe_dir) { - qDebug() << "Path to exe dir:" << exe_dir; + qDebug() << "Path to ICU folder:" << exe_dir; } #endif // defined(APPIMAGE) && defined(Q_OS_LINUX) diff --git a/src/app/valentina/main.cpp b/src/app/valentina/main.cpp index 98ff45433..153dd2b34 100644 --- a/src/app/valentina/main.cpp +++ b/src/app/valentina/main.cpp @@ -61,8 +61,19 @@ int main(int argc, char *argv[]) BrInitError error; if (br_init (&error)) { - exe_dir = br_find_exe_dir (nullptr); - u_setDataDirectory(exe_dir); + char *path = br_find_exe_dir(nullptr); + if (path) + { + const char* correction = "/../share/icu"; + exe_dir = static_cast (malloc(strlen(path)+strlen(correction)+1)); + if(exe_dir) + { + strcpy(exe_dir, path); + strcat(exe_dir, correction); + u_setDataDirectory(exe_dir); + } + free(path); + } } auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);}); @@ -134,7 +145,7 @@ int main(int argc, char *argv[]) #if defined(APPIMAGE) && defined(Q_OS_LINUX) if (exe_dir) { - qDebug() << "Path to exe dir:" << exe_dir; + qDebug() << "Path to ICU folder:" << exe_dir; } #endif // defined(APPIMAGE) && defined(Q_OS_LINUX) diff --git a/src/libs/vmisc/binreloc.c b/src/libs/vmisc/binreloc.c index 8b041af8b..191eeede1 100644 --- a/src/libs/vmisc/binreloc.c +++ b/src/libs/vmisc/binreloc.c @@ -244,6 +244,8 @@ _br_find_exe_for_symbol (const void *symbol, BrInitError *error) char *new_address_string = (char *) realloc (address_string, address_string_len); if (new_address_string == NULL){ *error = BR_INIT_ERROR_NOMEM; + free (address_string); + fclose (f); return (char *) NULL; } else