调试配置文件统一到debug.cfg
This commit is contained in:
parent
e6ead9b452
commit
9d6a7e5027
|
@ -3270,27 +3270,47 @@ void huagao_ds::init_support_caps_ex(void)
|
||||||
}
|
}
|
||||||
std::wstring huagao_ds::get_config_file(void)
|
std::wstring huagao_ds::get_config_file(void)
|
||||||
{
|
{
|
||||||
wchar_t path[MAX_PATH] = { 0 }, * name = NULL;
|
char* tmp = getenv("LOCALAPPDATA");
|
||||||
|
if (tmp)
|
||||||
|
{
|
||||||
|
std::wstring str(L"");
|
||||||
|
std::string path(tmp);
|
||||||
|
|
||||||
GetModuleFileNameW(me_, path, _countof(path) - 1);
|
path += std::string("\\") + PRODUCT_VENDOR + "Scan\\config\\debug.cfg";
|
||||||
name = wcsrchr(path, L'\\');
|
|
||||||
if (name++ == NULL)
|
|
||||||
name = path;
|
|
||||||
wcscpy_s(name, _countof(path) - 1 - (name - path), L"first.cfg");
|
|
||||||
|
|
||||||
return path;
|
return std::move(load_sane_util::ansi2unic(path.c_str()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wchar_t path[MAX_PATH] = { 0 }, * name = NULL;
|
||||||
|
|
||||||
|
GetModuleFileNameW(me_, path, _countof(path) - 1);
|
||||||
|
name = wcsrchr(path, L'\\');
|
||||||
|
if (name++ == NULL)
|
||||||
|
name = path;
|
||||||
|
wcscpy_s(name, _countof(path) - 1 - (name - path), L"debug.cfg");
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
std::wstring huagao_ds::get_config_value(const wchar_t* sec, const wchar_t* key)
|
std::wstring huagao_ds::get_config_value(const wchar_t* sec, const wchar_t* key)
|
||||||
{
|
{
|
||||||
wchar_t v[256] = { 0 };
|
wchar_t v[256] = { 0 };
|
||||||
|
std::wstring cfg_f(get_config_file());
|
||||||
|
|
||||||
GetPrivateProfileStringW(sec, key, L"", v, _countof(v) - 1, get_config_file().c_str());
|
if(!cfg_f.empty())
|
||||||
|
GetPrivateProfileStringW(sec, key, L"", v, _countof(v) - 1, get_config_file().c_str());
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
DWORD huagao_ds::get_config_number(const wchar_t* sec, const wchar_t* key)
|
DWORD huagao_ds::get_config_number(const wchar_t* sec, const wchar_t* key)
|
||||||
{
|
{
|
||||||
return GetPrivateProfileIntW(sec, key, 0, get_config_file().c_str());
|
std::wstring cfg_f(get_config_file());
|
||||||
|
|
||||||
|
if (cfg_f.empty())
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return GetPrivateProfileIntW(sec, key, 0, get_config_file().c_str());
|
||||||
}
|
}
|
||||||
int huagao_ds::handle_scanner_event(int ev)
|
int huagao_ds::handle_scanner_event(int ev)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue