调整WIN平台获取本地数据路径方式
This commit is contained in:
parent
5943ee86d6
commit
3dce0bf435
|
@ -463,9 +463,9 @@ extern "C"
|
||||||
|
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
static int get_log_config(const std::string& self_path, hg_log_type* type, std::string* path)
|
static int get_log_config(const std::string& root, hg_log_type* type, std::string* path)
|
||||||
{
|
{
|
||||||
std::string me(self_path + PATH_SEPARATOR + "Cfg" + PATH_SEPARATOR + " scanner.conf");
|
std::string me(root + PATH_SEPARATOR + "Cfg" + PATH_SEPARATOR + " scanner.conf");
|
||||||
int lv = LOG_LEVEL_ALL;
|
int lv = LOG_LEVEL_ALL;
|
||||||
hg_log_type tp = LOG_TYPE_FILE;
|
hg_log_type tp = LOG_TYPE_FILE;
|
||||||
|
|
||||||
|
@ -496,27 +496,21 @@ extern "C"
|
||||||
lv = LOG_LEVEL_FATAL;
|
lv = LOG_LEVEL_FATAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
create_folder((self_path + PATH_SEPARATOR + "Cfg").c_str());
|
create_folder((root + PATH_SEPARATOR + "Cfg").c_str());
|
||||||
|
|
||||||
return lv;
|
return lv;
|
||||||
}
|
}
|
||||||
std::string local_data_path(void)
|
std::string local_data_path(void)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char* tmp = getenv("TMP");
|
std::string env("LOCALAPPDATA"), lead("");
|
||||||
|
#else
|
||||||
|
std::string env("HOME"), lead(".");
|
||||||
|
#endif
|
||||||
|
char* tmp = getenv(env.c_str());
|
||||||
std::string home(tmp ? tmp : "");
|
std::string home(tmp ? tmp : "");
|
||||||
|
|
||||||
if (home.length())
|
home += PATH_SEPARATOR + lead;
|
||||||
{
|
|
||||||
size_t pos = home.rfind('\\');
|
|
||||||
if (pos++ != std::string::npos)
|
|
||||||
home.erase(pos);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
std::string home(getenv("HOME"));
|
|
||||||
|
|
||||||
home += "/.";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef OEM_HANWANG
|
#ifdef OEM_HANWANG
|
||||||
home += "HwScanner";
|
home += "HwScanner";
|
||||||
|
|
Loading…
Reference in New Issue