修复windows平台模块路径查找失败问题

This commit is contained in:
gb 2022-07-15 16:47:26 +08:00
parent bfc31af0cc
commit 277b51d55d
1 changed files with 6 additions and 2 deletions

View File

@ -33,7 +33,8 @@
#define iconv_t void*
#endif
static std::string g_sane_path = "";
static std::string g_sane_path("");
static std::string g_sane_name(GET_BACKEND_NAME);
namespace local_utility
{
@ -335,7 +336,7 @@ hg_sane_middleware::hg_sane_middleware(void) : opt_0_(nullptr), std_opt_(nullptr
sprintf(sane_ver, "%u.%u.%u", SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, VERSION_BUILD);
signal(SIGUSR1, &hg_sane_middleware::device_pnp);
hg_scanner_set_sane_info(GET_BACKEND_NAME, sane_ver);
hg_scanner_set_sane_info(g_sane_name.c_str(), sane_ver);
hg_scanner_initialize(local_utility::ui_cb, NULL);
#ifndef WIN32
@ -2037,8 +2038,11 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
GetModuleFileNameA(inst, path, _countof(path) - 1);
if (strrchr(path, '\\'))
{
g_sane_name = strrchr(path, '\\') + 1;
strrchr(path, '\\')[1] = 0;
g_sane_path = path;
if (g_sane_name.rfind('.') != std::string::npos)
g_sane_name.erase(g_sane_name.rfind('.'));
}
}
}