This commit is contained in:
13038267101 2022-07-05 18:01:20 +08:00
commit 86bbca92cb
2 changed files with 33 additions and 8 deletions

View File

@ -2506,6 +2506,8 @@ int hg_scanner::device_io_control(unsigned long code, void* data, unsigned* len)
SANE_Gamma* v = (SANE_Gamma*)data; SANE_Gamma* v = (SANE_Gamma*)data;
memcpy(v, custom_gamma_val_, sizeof(*custom_gamma_val_)); memcpy(v, custom_gamma_val_, sizeof(*custom_gamma_val_));
if (len)
*len = image_prc_param_.bits.color_mode;
return SCANNER_ERR_OK; return SCANNER_ERR_OK;
} }

View File

@ -506,15 +506,38 @@ extern "C"
} }
std::string local_data_path(void) std::string local_data_path(void)
{ {
#ifdef WIN32 static std::string local_data_path("");
std::string env("LOCALAPPDATA"), lead(""); static bool load_first = true;
#else
std::string env("HOME"), lead(".");
#endif
char* tmp = getenv(env.c_str());
std::string home(tmp ? tmp : "");
home += PATH_SEPARATOR + lead; if (load_first)
{
simple_ini first;
load_first = false;
if (first.load((get_scanner_path() + "first.cfg").c_str()) == 0)
{
std::string env = first.get("constraints", "local_data_path");
if (env.length())
local_data_path = env;
}
}
std::string home(local_data_path);
if (home.empty())
{
#ifdef WIN32
std::string env("LOCALAPPDATA"), lead("");
#else
std::string env("HOME"), lead(".");
#endif
char* tmp = getenv(env.c_str());
if (tmp)
home = tmp;
home += PATH_SEPARATOR + lead;
}
#ifdef OEM_HANWANG #ifdef OEM_HANWANG
home += "HanvonScan"; home += "HanvonScan";