Skip to content

Commit

Permalink
调整助手的安装路径,防止出现非管理员用户无法保存配置文件和录像回放临时文件的问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
apexliu committed Apr 16, 2017
1 parent 9bce1db commit 7608b6f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 23 deletions.
9 changes: 6 additions & 3 deletions build/builder/build-assist.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,20 @@ def build_installer(self):
def _build_installer():
tmp_path = os.path.join(env.root_path, 'dist', 'client', 'windows', 'assist')
tmp_app_path = os.path.join(tmp_path, 'apps')
tmp_cfg_path = os.path.join(tmp_path, 'cfg')
tmp_cfg_path = os.path.join(tmp_app_path, 'cfg')

if os.path.exists(tmp_app_path):
utils.remove(tmp_app_path)
if os.path.exists(tmp_cfg_path):
utils.remove(tmp_cfg_path)
# if os.path.exists(tmp_cfg_path):
# utils.remove(tmp_cfg_path)

utils.makedirs(tmp_app_path)
utils.makedirs(tmp_cfg_path)

utils.copy_file(os.path.join(env.root_path, 'out', 'client', ctx.bits_path, ctx.target_path), tmp_app_path, 'tp_assist.exe')
# utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'ssh.ini')
# utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'scp.ini')
# utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'telnet.ini')
utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'ssh.ini')
utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'scp.ini')
utils.copy_file(os.path.join(env.root_path, 'client', 'tp_assist', 'cfg'), tmp_cfg_path, 'telnet.ini')
Expand Down
51 changes: 31 additions & 20 deletions client/tp_assist/ts_env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <time.h>
#ifdef EX_OS_WIN32
# include <direct.h>
# include <ShlObj.h>
//# include <ShlObj.h>
#endif

TsEnv g_env;
Expand All @@ -28,41 +28,52 @@ bool TsEnv::init(void)
if (!ex_dirname(m_exec_path))
return false;


#ifdef _DEBUG
m_ssh_client_conf_file = m_exec_path;
ex_path_join(m_ssh_client_conf_file, false, L"ssh.ini", NULL);
ex_path_join(m_ssh_client_conf_file, false, L"cfg", L"ssh.ini", NULL);

m_scp_client_conf_file = m_exec_path;
ex_path_join(m_scp_client_conf_file, false, L"scp.ini", NULL);
ex_path_join(m_scp_client_conf_file, false, L"cfg", L"scp.ini", NULL);

m_telnet_client_conf_file = m_exec_path;
ex_path_join(m_telnet_client_conf_file, false, L"telnet.ini", NULL);
ex_path_join(m_telnet_client_conf_file, false, L"cfg", L"telnet.ini", NULL);

m_log_path = m_exec_path;
ex_path_join(m_log_path, false, L"log", NULL);

#ifdef _DEBUG
// m_ssh_client_conf_file = m_exec_path;
// ex_path_join(m_ssh_client_conf_file, false, L"ssh.ini", NULL);
//
// m_scp_client_conf_file = m_exec_path;
// ex_path_join(m_scp_client_conf_file, false, L"scp.ini", NULL);
//
// m_telnet_client_conf_file = m_exec_path;
// ex_path_join(m_telnet_client_conf_file, false, L"telnet.ini", NULL);
//
// m_log_path = m_exec_path;
// ex_path_join(m_log_path, false, L"log", NULL);

m_site_path = m_exec_path;
ex_path_join(m_site_path, true, L"..", L"..", L"..", L"..", L"client", L"tp_assist", L"site", NULL);

m_tools_path = m_exec_path;
ex_path_join(m_tools_path, true, L"..", L"..", L"..", L"..", L"client", L"tools", NULL);

#else
TCHAR szBuf[PATH_MAX] = { 0 };
SHGetSpecialFolderPathW(NULL, szBuf, CSIDL_APPDATA, FALSE);

m_ssh_client_conf_file = szBuf;// m_exec_path;
ex_path_join(m_ssh_client_conf_file, false, L"eomsoft", L"teleport", L"assist", L"cfg", L"ssh.ini", NULL);

m_scp_client_conf_file = szBuf;// m_exec_path;
ex_path_join(m_scp_client_conf_file, false, L"eomsoft", L"teleport", L"assist", L"cfg", L"scp.ini", NULL);

m_telnet_client_conf_file = szBuf;// m_exec_path;
ex_path_join(m_telnet_client_conf_file, false, L"eomsoft", L"teleport", L"assist", L"cfg", L"telnet.ini", NULL);

m_log_path = szBuf;// m_exec_path;
ex_path_join(m_log_path, false, L"eomsoft", L"teleport", L"assist", L"log", NULL);
// TCHAR szBuf[PATH_MAX] = { 0 };
// SHGetSpecialFolderPathW(NULL, szBuf, CSIDL_APPDATA, FALSE);
//
// m_ssh_client_conf_file = szBuf;// m_exec_path;
// ex_path_join(m_ssh_client_conf_file, false, L"eomsoft", L"teleport", L"assist", L"cfg", L"ssh.ini", NULL);
//
// m_scp_client_conf_file = szBuf;// m_exec_path;
// ex_path_join(m_scp_client_conf_file, false, L"eomsoft", L"teleport", L"assist", L"cfg", L"scp.ini", NULL);
//
// m_telnet_client_conf_file = szBuf;// m_exec_path;
// ex_path_join(m_telnet_client_conf_file, false, L"eomsoft", L"teleport", L"assist", L"cfg", L"telnet.ini", NULL);
//
// m_log_path = szBuf;// m_exec_path;
// ex_path_join(m_log_path, false, L"eomsoft", L"teleport", L"assist", L"log", NULL);

m_site_path = m_exec_path;
ex_path_join(m_site_path, false, L"site", NULL);
Expand Down
Binary file modified dist/client/windows/assist/installer.nsi
Binary file not shown.
Binary file modified dist/client/windows/assist/main.nsh
Binary file not shown.
Binary file modified dist/client/windows/assist/setup.nsh
Binary file not shown.

0 comments on commit 7608b6f

Please sign in to comment.