[Ttssh2-commit] [3298] RCPの受信先ディレクトリを指定できるようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 4月 9日 (木) 08:38:02 JST


Revision: 3298
          http://svn.sourceforge.jp/view?root=ttssh2&view=rev&rev=3298
Author:   r850
Date:     2009-04-09 08:38:01 +0900 (Thu, 09 Apr 2009)

Log Message:
-----------
RCPの受信先ディレクトリを指定できるようにした。

Modified Paths:
--------------
    trunk/teraterm/ttpcmn/ttpcmn.def
    trunk/ttssh2/ttxssh/resource.h
    trunk/ttssh2/ttxssh/ttxssh.c
    trunk/ttssh2/ttxssh/ttxssh.rc
    trunk/ttssh2/ttxssh/util.c


-------------- next part --------------
Modified: trunk/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- trunk/teraterm/ttpcmn/ttpcmn.def	2009-04-08 15:11:32 UTC (rev 3297)
+++ trunk/teraterm/ttpcmn/ttpcmn.def	2009-04-08 23:38:01 UTC (rev 3298)
@@ -39,3 +39,6 @@
   GetI18nLogfont @41
   
   OutputDebugPrintf @49
+  
+  is_NT4 @50
+  doSelectFolder @51

Modified: trunk/ttssh2/ttxssh/resource.h
===================================================================
--- trunk/ttssh2/ttxssh/resource.h	2009-04-08 15:11:32 UTC (rev 3297)
+++ trunk/ttssh2/ttxssh/resource.h	2009-04-08 23:38:01 UTC (rev 3298)
@@ -126,6 +126,7 @@
 #define IDC_SENDFILE_SELECT             1090
 #define IDC_FILE_PROGRESS               1092
 #define IDC_FILENAME                    1093
+#define IDC_RECVDIR_SELECT              1093
 #define IDC_PROGRESS                    1094
 #define IDC_FN_STATIC                   1095
 #define IDC_RECVFILE                    1096
@@ -136,6 +137,7 @@
 #define IDC_LOCALUSERNAMELABEL          1100
 #define IDC_RECV_TO_DIRECTORY           1100
 #define IDC_LOCALUSERNAME               1101
+#define IDC_RECVFILE_TO                 1101
 #define IDC_CHOOSEHOSTRSAFILE           1102
 #define IDC_HOSTRSAFILENAME             1103
 #define IDC_EDIT3                       1103

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2009-04-08 15:11:32 UTC (rev 3297)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2009-04-08 23:38:01 UTC (rev 3298)
@@ -37,6 +37,7 @@
 #include "util.h"
 #include "ssh.h"
 #include "ttcommon.h"
+#include "ttlib.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -3062,6 +3063,7 @@
                                      LPARAM lParam)
 {
 	static char sendfile[MAX_PATH] = "";
+	static char recvdir[MAX_PATH] = "";
 	HWND hWnd;
 	HDROP hDrop;
 	UINT uFileNo;
@@ -3073,8 +3075,10 @@
 		DragAcceptFiles(dlg, TRUE);
 
 		// SCPƒtƒ@ƒCƒ‹ŽóMæ‚ð•\Ž¦‚·‚é
-		_snprintf_s(szFileName, sizeof(szFileName), _TRUNCATE, "To:     %s", pvar->ts->FileDir);
-		SendMessage(GetDlgItem(dlg, IDC_RECV_TO_DIRECTORY), WM_SETTEXT, 0, (LPARAM)szFileName);
+		if (recvdir[0] == '\0') {
+			_snprintf_s(recvdir, MAX_PATH, _TRUNCATE, "%s", pvar->ts->FileDir);
+		}
+		SendMessage(GetDlgItem(dlg, IDC_RECVFILE_TO), WM_SETTEXT, 0, (LPARAM)recvdir);
 
 #ifdef SFTP_DEBUG
 		ShowWindow(GetDlgItem(dlg, IDC_SFTP_TEST), SW_SHOW);
@@ -3131,6 +3135,12 @@
 			}
 			}
 			return TRUE;
+		case IDC_RECVDIR_SELECT | (BN_CLICKED << 16):
+			{
+			doSelectFolder(dlg, recvdir, MAX_PATH, "Choose destination directory");
+			SendMessage(GetDlgItem(dlg, IDC_RECVFILE_TO), WM_SETTEXT, 0, (LPARAM)recvdir);
+			}
+			return TRUE;
 		}
 
 		switch (LOWORD(wParam)) {
@@ -3153,7 +3163,14 @@
 			hWnd = GetDlgItem(dlg, IDC_RECVFILE);
 			SendMessage(hWnd, WM_GETTEXT , sizeof(szFileName), (LPARAM)szFileName);
 			if (szFileName[0] != '\0') {
-				SSH_start_scp_receive(pvar, szFileName);
+				char recvpath[MAX_PATH] = "";
+				char* fn = strrchr(szFileName, '/');
+				if (fn && fn[1] == '\0') {
+					return FALSE;
+				}
+				SendMessage(GetDlgItem(dlg, IDC_RECVFILE_TO), WM_GETTEXT, sizeof(recvdir), (LPARAM)recvdir);
+				_snprintf_s(recvpath, MAX_PATH, _TRUNCATE, "%s\\%s", recvdir, fn ? (fn + 1) : szFileName);
+				SSH_scp_transaction(pvar, szFileName, recvpath, FROMREMOTE);
 				EndDialog(dlg, 1); // dialog close
 				return TRUE;
 			}

Modified: trunk/ttssh2/ttxssh/ttxssh.rc
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.rc	2009-04-08 15:11:32 UTC (rev 3297)
+++ trunk/ttssh2/ttxssh/ttxssh.rc	2009-04-08 23:38:01 UTC (rev 3298)
@@ -322,8 +322,10 @@
     LTEXT           "-----------------------------------------------------------------------------------------------------------",IDC_DUMMY_LINE,7,63,265,8
     LTEXT           "Fr&om:",IDC_STATIC,7,81,20,8
     EDITTEXT        IDC_RECVFILE,37,78,154,14,ES_AUTOHSCROLL
-    LTEXT           "To: ",IDC_RECV_TO_DIRECTORY,15,100,187,8
+    LTEXT           "To: ",IDC_RECV_TO_DIRECTORY,15,100,16,8
     PUSHBUTTON      "&Receive",IDC_RECV,222,77,50,14
+    PUSHBUTTON      "...",IDC_RECVDIR_SELECT,196,97,14,14
+    EDITTEXT        IDC_RECVFILE_TO,37,97,154,14,ES_AUTOHSCROLL
 END
 
 IDD_SSHSCP_PROGRESS DIALOGEX 0, 0, 166, 82

Modified: trunk/ttssh2/ttxssh/util.c
===================================================================
--- trunk/ttssh2/ttxssh/util.c	2009-04-08 15:11:32 UTC (rev 3297)
+++ trunk/ttssh2/ttxssh/util.c	2009-04-08 23:38:01 UTC (rev 3298)
@@ -252,16 +252,3 @@
 
 	return TRUE;
 }
-
-BOOL is_NT4()
-{
-	OSVERSIONINFO osvi;
-
-	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-	GetVersionEx(&osvi);
-	if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT &&
-	    osvi.dwMajorVersion == 4) {
-		return TRUE;
-	}
-	return FALSE;
-}



Ttssh2-commit メーリングリストの案内
Back to archive index