Loweynet
Revisão | 24d1bc42635bcba06b0330864341db64fcf50b13 (tree) |
---|---|
Hora | 2012-02-15 02:18:04 |
Autor | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Add support for automatic directory creation.
@@ -108,6 +108,8 @@ extern SIZE MirrorDlgSize; | ||
108 | 108 | extern int VaxSemicolon; |
109 | 109 | extern int DebugConsole; |
110 | 110 | extern int CancelFlg; |
111 | +// ディレクトリ自動作成 | |
112 | +extern int MakeAllDir; | |
111 | 113 | |
112 | 114 | /*===== ローカルなワーク =====*/ |
113 | 115 |
@@ -136,6 +138,46 @@ static double FileSize; /* ファイル総容量 */ | ||
136 | 138 | * なし |
137 | 139 | *----------------------------------------------------------------------------*/ |
138 | 140 | |
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 | + | |
139 | 181 | void DownLoadProc(int ChName, int ForceFile, int All) |
140 | 182 | { |
141 | 183 | FILELIST *FileListBase; |
@@ -248,7 +290,13 @@ void DownLoadProc(int ChName, int ForceFile, int All) | ||
248 | 290 | if(Pkt.Mode == EXIST_ABORT) |
249 | 291 | break; |
250 | 292 | else if(Pkt.Mode != EXIST_IGNORE) |
293 | + // ディレクトリ自動作成 | |
294 | +// AddTransFileList(&Pkt); | |
295 | + { | |
296 | + if(MakeAllDir == YES) | |
297 | + MakeDirFromLocalPath(Pkt.LocalFile); | |
251 | 298 | AddTransFileList(&Pkt); |
299 | + } | |
252 | 300 | } |
253 | 301 | Pos = Pos->Next; |
254 | 302 | } |
@@ -890,6 +938,72 @@ static INT_PTR CALLBACK DownExistDialogCallBack(HWND hDlg, UINT iMessage, WPARAM | ||
890 | 938 | * なし |
891 | 939 | *----------------------------------------------------------------------------*/ |
892 | 940 | |
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 | + | |
893 | 1007 | void UpLoadListProc(int ChName, int All) |
894 | 1008 | { |
895 | 1009 | FILELIST *FileListBase; |
@@ -961,6 +1075,16 @@ void UpLoadListProc(int ChName, int All) | ||
961 | 1075 | else |
962 | 1076 | break; |
963 | 1077 | } |
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 | + } | |
964 | 1088 | ReplaceAll(Pkt.RemoteFile, '\\', '/'); |
965 | 1089 | |
966 | 1090 | if(AskHostType() == HTYPE_ACOS) |
@@ -1034,6 +1158,12 @@ void UpLoadListProc(int ChName, int All) | ||
1034 | 1158 | break; |
1035 | 1159 | else if(Pkt.Mode != EXIST_IGNORE) |
1036 | 1160 | { |
1161 | + // ディレクトリ自動作成 | |
1162 | + if(MakeAllDir == YES) | |
1163 | + { | |
1164 | + if(MakeDirFromRemotePath(Pkt.RemoteFile, FirstAdd) == YES) | |
1165 | + FirstAdd = NO; | |
1166 | + } | |
1037 | 1167 | if((FirstAdd == YES) && (AskNoFullPathMode() == YES)) |
1038 | 1168 | { |
1039 | 1169 | strcpy(Pkt1.Cmd, "SETCUR"); |
@@ -1202,6 +1332,12 @@ void UpLoadDragProc(WPARAM wParam) | ||
1202 | 1332 | break; |
1203 | 1333 | else if(Pkt.Mode != EXIST_IGNORE) |
1204 | 1334 | { |
1335 | + // ディレクトリ自動作成 | |
1336 | + if(MakeAllDir == YES) | |
1337 | + { | |
1338 | + if(MakeDirFromRemotePath(Pkt.RemoteFile, FirstAdd) == YES) | |
1339 | + FirstAdd = NO; | |
1340 | + } | |
1205 | 1341 | if((FirstAdd == YES) && (AskNoFullPathMode() == YES)) |
1206 | 1342 | { |
1207 | 1343 | strcpy(Pkt1.Cmd, "SETCUR"); |
@@ -233,6 +233,8 @@ BYTE CertificateCacheHash[MAX_CERT_CACHE_HASH][20]; | ||
233 | 233 | BYTE SSLRootCAFileHash[20]; |
234 | 234 | // ファイルアイコン表示対応 |
235 | 235 | int DispFileIcon = NO; |
236 | +// ディレクトリ自動作成 | |
237 | +int MakeAllDir = YES; | |
236 | 238 | |
237 | 239 | |
238 | 240 |