• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

FFFTPのソースコードです。


Commit MetaInfo

Revision24d1bc42635bcba06b0330864341db64fcf50b13 (tree)
Time2012-02-15 02:18:04
Authors_kawamoto <s_kawamoto@user...>
Commiters_kawamoto

Log Message

Add support for automatic directory creation.

Change Summary

Incremental Difference

Binary files a/FFFTP_Eng_Release/FFFTP.exe and b/FFFTP_Eng_Release/FFFTP.exe differ
Binary files a/Release/FFFTP.exe and b/Release/FFFTP.exe differ
--- a/ftpproc.c
+++ b/ftpproc.c
@@ -108,6 +108,8 @@ extern SIZE MirrorDlgSize;
108108 extern int VaxSemicolon;
109109 extern int DebugConsole;
110110 extern int CancelFlg;
111+// ディレクトリ自動作成
112+extern int MakeAllDir;
111113
112114 /*===== ローカルなワーク =====*/
113115
@@ -136,6 +138,46 @@ static double FileSize; /* ファイル総容量 */
136138 * なし
137139 *----------------------------------------------------------------------------*/
138140
141+// ディレクトリ自動作成
142+// ローカル側のパスから必要なフォルダを作成
143+int MakeDirFromLocalPath(char* LocalFile)
144+{
145+ TRANSPACKET Pkt;
146+ char* pDelimiter;
147+ char* pNext;
148+ char* Cat;
149+ int Len;
150+ char Tmp[FMAX_PATH+1];
151+ int Make;
152+ pDelimiter = LocalFile;
153+ Make = NO;
154+ while(pNext = strchr(pDelimiter, '\\'))
155+ {
156+ Len = pNext - LocalFile;
157+ strncpy(Pkt.LocalFile, LocalFile, Len);
158+ Pkt.LocalFile[Len] = '\0';
159+ AskLocalCurDir(Tmp, FMAX_PATH);
160+ SetYenTail(Tmp);
161+ if(strncmp(LocalFile, Tmp, Len + 1) != 0)
162+ {
163+ Cat = Pkt.LocalFile + (pDelimiter - LocalFile);
164+ if(FnameCnv == FNAME_LOWER)
165+ _mbslwr(Cat);
166+ else if(FnameCnv == FNAME_UPPER)
167+ _mbsupr(Cat);
168+ ReplaceAll(Pkt.LocalFile, '/', '\\');
169+
170+ strcpy(Pkt.Cmd, "MKD ");
171+ strcpy(Pkt.RemoteFile, "");
172+ AddTransFileList(&Pkt);
173+
174+ Make = YES;
175+ }
176+ pDelimiter = pNext + 1;
177+ }
178+ return Make;
179+}
180+
139181 void DownLoadProc(int ChName, int ForceFile, int All)
140182 {
141183 FILELIST *FileListBase;
@@ -248,7 +290,13 @@ void DownLoadProc(int ChName, int ForceFile, int All)
248290 if(Pkt.Mode == EXIST_ABORT)
249291 break;
250292 else if(Pkt.Mode != EXIST_IGNORE)
293+ // ディレクトリ自動作成
294+// AddTransFileList(&Pkt);
295+ {
296+ if(MakeAllDir == YES)
297+ MakeDirFromLocalPath(Pkt.LocalFile);
251298 AddTransFileList(&Pkt);
299+ }
252300 }
253301 Pos = Pos->Next;
254302 }
@@ -890,6 +938,72 @@ static INT_PTR CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM
890938 * なし
891939 *----------------------------------------------------------------------------*/
892940
941+// ディレクトリ自動作成
942+// リモート側のパスから必要なディレクトリを作成
943+int MakeDirFromRemotePath(char* RemoteFile, int FirstAdd)
944+{
945+ TRANSPACKET Pkt;
946+ TRANSPACKET Pkt1;
947+ char* pDelimiter;
948+ char* pNext;
949+ char* Cat;
950+ int Len;
951+ char Tmp[FMAX_PATH+1];
952+ int Make;
953+ pDelimiter = RemoteFile;
954+ Make = NO;
955+ while(pNext = strchr(pDelimiter, '/'))
956+ {
957+ Len = pNext - RemoteFile;
958+ strncpy(Pkt.RemoteFile, RemoteFile, Len);
959+ Pkt.RemoteFile[Len] = '\0';
960+ AskRemoteCurDir(Tmp, FMAX_PATH);
961+ SetSlashTail(Tmp);
962+ if(strncmp(RemoteFile, Tmp, Len + 1) != 0)
963+ {
964+ Cat = Pkt.RemoteFile + (pDelimiter - RemoteFile);
965+ if(FnameCnv == FNAME_LOWER)
966+ _mbslwr(Cat);
967+ else if(FnameCnv == FNAME_UPPER)
968+ _mbsupr(Cat);
969+#if defined(HAVE_TANDEM)
970+ Pkt.FileCode = 0;
971+ Pkt.PriExt = DEF_PRIEXT;
972+ Pkt.SecExt = DEF_SECEXT;
973+ Pkt.MaxExt = DEF_MAXEXT;
974+#endif
975+ ReplaceAll(Pkt.RemoteFile, '\\', '/');
976+
977+ if(AskHostType() == HTYPE_ACOS)
978+ {
979+ strcpy(Pkt.RemoteFile, "'");
980+ strcat(Pkt.RemoteFile, AskHostLsName());
981+ strcat(Pkt.RemoteFile, "(");
982+ strcat(Pkt.RemoteFile, Cat);
983+ strcat(Pkt.RemoteFile, ")");
984+ strcat(Pkt.RemoteFile, "'");
985+ }
986+ else if(AskHostType() == HTYPE_ACOS_4)
987+ strcpy(Pkt.RemoteFile, Cat);
988+
989+ if((FirstAdd == YES) && (AskNoFullPathMode() == YES))
990+ {
991+ strcpy(Pkt1.Cmd, "SETCUR");
992+ AskRemoteCurDir(Pkt1.RemoteFile, FMAX_PATH);
993+ AddTransFileList(&Pkt1);
994+ }
995+ FirstAdd = NO;
996+ strcpy(Pkt.Cmd, "MKD ");
997+ strcpy(Pkt.LocalFile, "");
998+ AddTransFileList(&Pkt);
999+
1000+ Make = YES;
1001+ }
1002+ pDelimiter = pNext + 1;
1003+ }
1004+ return Make;
1005+}
1006+
8931007 void UpLoadListProc(int ChName, int All)
8941008 {
8951009 FILELIST *FileListBase;
@@ -961,6 +1075,16 @@ void UpLoadListProc(int ChName, int All)
9611075 else
9621076 break;
9631077 }
1078+ // バグ修正
1079+ AskRemoteCurDir(Tmp, FMAX_PATH);
1080+ SetSlashTail(Tmp);
1081+ if(strncmp(Pkt.RemoteFile, Tmp, strlen(Tmp)) != 0)
1082+ {
1083+ if((Cat = strrchr(Pkt.RemoteFile, '/')) != NULL)
1084+ Cat++;
1085+ else
1086+ Cat = Pkt.RemoteFile;
1087+ }
9641088 ReplaceAll(Pkt.RemoteFile, '\\', '/');
9651089
9661090 if(AskHostType() == HTYPE_ACOS)
@@ -1034,6 +1158,12 @@ void UpLoadListProc(int ChName, int All)
10341158 break;
10351159 else if(Pkt.Mode != EXIST_IGNORE)
10361160 {
1161+ // ディレクトリ自動作成
1162+ if(MakeAllDir == YES)
1163+ {
1164+ if(MakeDirFromRemotePath(Pkt.RemoteFile, FirstAdd) == YES)
1165+ FirstAdd = NO;
1166+ }
10371167 if((FirstAdd == YES) && (AskNoFullPathMode() == YES))
10381168 {
10391169 strcpy(Pkt1.Cmd, "SETCUR");
@@ -1202,6 +1332,12 @@ void UpLoadDragProc(WPARAM wParam)
12021332 break;
12031333 else if(Pkt.Mode != EXIST_IGNORE)
12041334 {
1335+ // ディレクトリ自動作成
1336+ if(MakeAllDir == YES)
1337+ {
1338+ if(MakeDirFromRemotePath(Pkt.RemoteFile, FirstAdd) == YES)
1339+ FirstAdd = NO;
1340+ }
12051341 if((FirstAdd == YES) && (AskNoFullPathMode() == YES))
12061342 {
12071343 strcpy(Pkt1.Cmd, "SETCUR");
--- a/main.c
+++ b/main.c
@@ -233,6 +233,8 @@ BYTE CertificateCacheHash[MAX_CERT_CACHE_HASH][20];
233233 BYTE SSLRootCAFileHash[20];
234234 // ファイルアイコン表示対応
235235 int DispFileIcon = NO;
236+// ディレクトリ自動作成
237+int MakeAllDir = YES;
236238
237239
238240