Forgot to add a correction.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-11-29 12:24:00 +02:00
parent 7624b27409
commit 18284289a0
3 changed files with 30 additions and 6 deletions

View File

@ -59,9 +59,20 @@ int main(int argc, char *argv[])
BrInitError error; BrInitError error;
if (br_init (&error)) if (br_init (&error))
{ {
exe_dir = br_find_exe_dir (nullptr); char *path = br_find_exe_dir(nullptr);
if (path)
{
const char* correction = "/../share/icu";
exe_dir = static_cast<char *> (malloc(strlen(path)+strlen(correction)+1));
if(exe_dir)
{
strcpy(exe_dir, path);
strcat(exe_dir, correction);
u_setDataDirectory(exe_dir); u_setDataDirectory(exe_dir);
} }
free(path);
}
}
auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);}); auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);});
#endif #endif
@ -102,7 +113,7 @@ int main(int argc, char *argv[])
#if defined(APPIMAGE) && defined(Q_OS_LINUX) #if defined(APPIMAGE) && defined(Q_OS_LINUX)
if (exe_dir) if (exe_dir)
{ {
qDebug() << "Path to exe dir:" << exe_dir; qDebug() << "Path to ICU folder:" << exe_dir;
} }
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX) #endif // defined(APPIMAGE) && defined(Q_OS_LINUX)

View File

@ -61,9 +61,20 @@ int main(int argc, char *argv[])
BrInitError error; BrInitError error;
if (br_init (&error)) if (br_init (&error))
{ {
exe_dir = br_find_exe_dir (nullptr); char *path = br_find_exe_dir(nullptr);
if (path)
{
const char* correction = "/../share/icu";
exe_dir = static_cast<char *> (malloc(strlen(path)+strlen(correction)+1));
if(exe_dir)
{
strcpy(exe_dir, path);
strcat(exe_dir, correction);
u_setDataDirectory(exe_dir); u_setDataDirectory(exe_dir);
} }
free(path);
}
}
auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);}); auto FreeMemory = qScopeGuard([exe_dir] {free(exe_dir);});
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX) #endif // defined(APPIMAGE) && defined(Q_OS_LINUX)
@ -134,7 +145,7 @@ int main(int argc, char *argv[])
#if defined(APPIMAGE) && defined(Q_OS_LINUX) #if defined(APPIMAGE) && defined(Q_OS_LINUX)
if (exe_dir) if (exe_dir)
{ {
qDebug() << "Path to exe dir:" << exe_dir; qDebug() << "Path to ICU folder:" << exe_dir;
} }
#endif // defined(APPIMAGE) && defined(Q_OS_LINUX) #endif // defined(APPIMAGE) && defined(Q_OS_LINUX)

View File

@ -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); char *new_address_string = (char *) realloc (address_string, address_string_len);
if (new_address_string == NULL){ if (new_address_string == NULL){
*error = BR_INIT_ERROR_NOMEM; *error = BR_INIT_ERROR_NOMEM;
free (address_string);
fclose (f);
return (char *) NULL; return (char *) NULL;
} }
else else