[Ttssh2-commit] [5828] チケット #34943 設定フォルダを開く

svnno****@sourc***** svnno****@sourc*****
2015年 3月 24日 (火) 23:24:05 JST


Revision: 5828
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5828
Author:   yutakapon
Date:     2015-03-24 23:24:02 +0900 (Tue, 24 Mar 2015)
Log Message:
-----------
チケット #34943 設定フォルダを開く

ssh_known_hosts ファイルがフルパス指定だった場合に対応した。

Ticket Links:
------------
    http://sourceforge.jp/projects/ttssh2/tracker/detail/34943

Modified Paths:
--------------
    trunk/teraterm/teraterm/vtwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/teraterm/vtwin.cpp
===================================================================
--- trunk/teraterm/teraterm/vtwin.cpp	2015-03-23 15:02:28 UTC (rev 5827)
+++ trunk/teraterm/teraterm/vtwin.cpp	2015-03-24 14:24:02 UTC (rev 5828)
@@ -4772,10 +4772,20 @@
 			if (((h = GetModuleHandle("ttxssh.dll")) != NULL)) {
 				func = (PSSH_read_known_hosts_file)GetProcAddress(h, "TTXReadKnownHostsFile");
 				if (func) {
-					int ret = func(hostsfilename, sizeof(hostsfilename));
+					int ret = func(temp, sizeof(temp));
 					if (ret) {
-						strncpy_s(hostsfilepath, sizeof(hostsfilepath), teratermexepath, _TRUNCATE);
-						_snprintf_s(temp, sizeof(temp), "%s\\%s", hostsfilepath, hostsfilename);
+						char *s = strstr(temp, ":\\");
+
+						if (s) { // full path
+							ExtractFileName(temp, hostsfilename, sizeof(hostsfilename));
+							ExtractDirName(temp, hostsfilepath);
+						}
+						else { // relative path
+							strncpy_s(hostsfilepath, sizeof(hostsfilepath), teratermexepath, _TRUNCATE);
+							strncpy_s(hostsfilename, sizeof(hostsfilename), temp, _TRUNCATE);
+							_snprintf_s(temp, sizeof(temp), "%s\\%s", hostsfilepath, hostsfilename);
+						}
+
 						SetDlgItemText(hDlgWnd, IDC_SSH_SETUPDIR_EDIT, temp);
 					}
 				}



Ttssh2-commit メーリングリストの案内