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