@@ -1057,7 +1057,7 @@ function TMailRuCloudWFX.FsFindClose(Hdl: THandle): Integer;
1057
1057
end ;
1058
1058
1059
1059
function TMailRuCloudWFX.FsFindFirst (Path: WideString; var FindData: tWIN32FINDDATAW): THandle;
1060
- var // Получение первого файла в папке. Result тоталом не используется (можно использовать для работы плагина).
1060
+ var // Получение первого файла в папке. Result не используется (можно использовать для работы плагина).
1061
1061
RealPath: TRealPath;
1062
1062
getResult: Integer;
1063
1063
SkipListDelete, SkipListRenMov, CanAbortRenMov, RenMovAborted: Boolean;
@@ -1066,7 +1066,6 @@ function TMailRuCloudWFX.FsFindFirst(Path: WideString; var FindData: tWIN32FINDD
1066
1066
begin
1067
1067
ThreadSkipListDelete.TryGetValue(GetCurrentThreadID(), SkipListDelete);
1068
1068
ThreadSkipListRenMov.TryGetValue(GetCurrentThreadID(), SkipListRenMov);
1069
-
1070
1069
ThreadCanAbortRenMov.TryGetValue(GetCurrentThreadID(), CanAbortRenMov);
1071
1070
1072
1071
if (CanAbortRenMov and TCProgress.Progress(Path)) then
@@ -1079,87 +1078,88 @@ function TMailRuCloudWFX.FsFindFirst(Path: WideString; var FindData: tWIN32FINDD
1079
1078
1080
1079
if SkipListDelete or SkipListRenMov or RenMovAborted then
1081
1080
begin
1081
+ CurrentListing := [];
1082
1082
SetLastError(ERROR_NO_MORE_FILES);
1083
- exit(INVALID_HANDLE_VALUE);
1084
- end ;
1085
-
1086
- // Result := FIND_NO_MORE_FILES;
1087
- GlobalPath := Path;
1088
- if GlobalPath = ' \' then
1089
- begin // список соединений
1090
- Accounts := AccountSettings.GetAccountsList([ATPrivate, ATPublic], SettingsManager.Settings.EnabledVirtualTypes);
1091
- if (Accounts.Count > 0 ) then
1092
- begin
1093
- FindData := GetFindDataEmptyDir(Accounts[0 ]);
1094
- FileCounter := 1 ;
1095
- Result := FIND_ROOT_DIRECTORY;
1096
- end else begin
1097
- Result := INVALID_HANDLE_VALUE; // Нельзя использовать exit
1098
- SetLastError(ERROR_NO_MORE_FILES);
1099
- end ;
1083
+ Result := FIND_NO_MORE_FILES;
1100
1084
end else begin
1101
- RealPath.FromPath(GlobalPath);
1102
- CurrentCloud := ConnectionManager.Get(RealPath.account, getResult);
1103
-
1104
- if getResult <> CLOUD_OPERATION_OK then
1105
- begin
1106
- SetLastError(ERROR_ACCESS_DENIED);
1107
- exit(INVALID_HANDLE_VALUE);
1108
- end ;
1085
+ // Result := FIND_NO_MORE_FILES;
1086
+ GlobalPath := Path;
1087
+ if GlobalPath = ' \' then
1088
+ begin // список соединений
1089
+ Accounts := AccountSettings.GetAccountsList([ATPrivate, ATPublic], SettingsManager.Settings.EnabledVirtualTypes);
1090
+ if (Accounts.Count > 0 ) then
1091
+ begin
1092
+ FindData := GetFindDataEmptyDir(Accounts[0 ]);
1093
+ FileCounter := 1 ;
1094
+ Result := FIND_ROOT_DIRECTORY;
1095
+ end else begin
1096
+ Result := INVALID_HANDLE_VALUE; // Нельзя использовать exit
1097
+ SetLastError(ERROR_NO_MORE_FILES);
1098
+ end ;
1099
+ end else begin
1100
+ RealPath.FromPath(GlobalPath);
1101
+ CurrentCloud := ConnectionManager.Get(RealPath.account, getResult);
1109
1102
1110
- if not Assigned(CurrentCloud) then
1111
- begin
1112
- SetLastError(ERROR_PATH_NOT_FOUND );
1113
- exit(INVALID_HANDLE_VALUE);
1114
- end ;
1103
+ if getResult <> CLOUD_OPERATION_OK then
1104
+ begin
1105
+ SetLastError(ERROR_ACCESS_DENIED );
1106
+ exit(INVALID_HANDLE_VALUE);
1107
+ end ;
1115
1108
1116
- if RealPath.trashDir then
1117
- begin
1118
- if not CurrentCloud.getTrashbinListing(CurrentListing) then
1119
- SetLastError(ERROR_PATH_NOT_FOUND);
1120
- end else if RealPath.sharedDir then
1121
- begin
1122
- if not CurrentCloud.getSharedLinksListing(CurrentListing) then
1123
- SetLastError(ERROR_PATH_NOT_FOUND); // that will be interpreted as symlinks later
1124
- end else if RealPath.invitesDir then
1125
- begin
1126
- if not CurrentCloud.getIncomingLinksListing(CurrentListing, CurrentIncomingInvitesListing) then
1127
- SetLastError(ERROR_PATH_NOT_FOUND); // одновременно получаем оба листинга, чтобы не перечитывать листинг инватов на каждый чих
1128
- end else begin // Нужно проверить, является ли открываемый объект каталогом - для файлов API вернёт листинг вышестоящего каталога, см. issue #174
1129
- if not CurrentCloud.getDirListing(RealPath.Path, CurrentListing) then
1109
+ if not Assigned(CurrentCloud) then
1110
+ begin
1130
1111
SetLastError(ERROR_PATH_NOT_FOUND);
1131
- end ;
1112
+ exit(INVALID_HANDLE_VALUE);
1113
+ end ;
1132
1114
1133
- if RealPath.isVirtual and not RealPath.isInAccountsList then // игнорим попытки получить листинги объектов вирутальных каталогов
1134
- begin
1135
- SetLastError(ERROR_ACCESS_DENIED);
1136
- exit(INVALID_HANDLE_VALUE);
1137
- end ;
1115
+ if RealPath.trashDir then
1116
+ begin
1117
+ if not CurrentCloud.getTrashbinListing(CurrentListing) then
1118
+ SetLastError(ERROR_PATH_NOT_FOUND);
1119
+ end else if RealPath.sharedDir then
1120
+ begin
1121
+ if not CurrentCloud.getSharedLinksListing(CurrentListing) then
1122
+ SetLastError(ERROR_PATH_NOT_FOUND); // that will be interpreted as symlinks later
1123
+ end else if RealPath.invitesDir then
1124
+ begin
1125
+ if not CurrentCloud.getIncomingLinksListing(CurrentListing, CurrentIncomingInvitesListing) then
1126
+ SetLastError(ERROR_PATH_NOT_FOUND); // одновременно получаем оба листинга, чтобы не перечитывать листинг инватов на каждый чих
1127
+ end else begin // Нужно проверить, является ли открываемый объект каталогом - для файлов API вернёт листинг вышестоящего каталога, см. issue #174
1128
+ if not CurrentCloud.getDirListing(RealPath.Path, CurrentListing) then
1129
+ SetLastError(ERROR_PATH_NOT_FOUND);
1130
+ end ;
1138
1131
1139
- if CurrentCloud.IsPublicAccount then
1140
- CurrentItem := CurrentListing.FindByName(ExtractUniversalFileName(RealPath.Path))
1141
- else
1142
- CurrentItem := CurrentListing.FindByHomePath(RealPath.Path);
1132
+ if RealPath.isVirtual and not RealPath.isInAccountsList then // игнорим попытки получить листинги объектов вирутальных каталогов
1133
+ begin
1134
+ SetLastError(ERROR_ACCESS_DENIED);
1135
+ exit(INVALID_HANDLE_VALUE);
1136
+ end ;
1143
1137
1144
- if not (CurrentItem.isNone or CurrentItem.isDir) then
1145
- begin
1146
- SetLastError(ERROR_PATH_NOT_FOUND);
1147
- exit(INVALID_HANDLE_VALUE);
1148
- end ;
1138
+ if CurrentCloud.IsPublicAccount then
1139
+ CurrentItem := CurrentListing.FindByName(ExtractUniversalFileName(RealPath.Path))
1140
+ else
1141
+ CurrentItem := CurrentListing.FindByHomePath(RealPath.Path);
1149
1142
1150
- if (Length(CurrentListing) = 0 ) then
1151
- begin
1152
- FindData := GetFindDataEmptyDir(); // воркароунд бага с невозможностью входа в пустой каталог, см. http://www.ghisler.ch/board/viewtopic.php?t=42399
1153
- Result := FIND_NO_MORE_FILES;
1154
- SetLastError(ERROR_NO_MORE_FILES);
1155
- end else begin
1143
+ if not (CurrentItem.isNone or CurrentItem.isDir) then
1144
+ begin
1145
+ SetLastError(ERROR_PATH_NOT_FOUND);
1146
+ exit(INVALID_HANDLE_VALUE);
1147
+ end ;
1156
1148
1157
- FindData := CurrentListing[0 ].ToFindData(RealPath.sharedDir); // folders inside shared links directory must be displayed as symlinks
1158
- FileCounter := 1 ;
1159
- if RealPath.sharedDir then
1160
- Result := FIND_SHARED_LINKS
1161
- else
1162
- Result := FIND_OK;
1149
+ if (Length(CurrentListing) = 0 ) then
1150
+ begin
1151
+ FindData := GetFindDataEmptyDir(); // воркароунд бага с невозможностью входа в пустой каталог, см. http://www.ghisler.ch/board/viewtopic.php?t=42399
1152
+ Result := FIND_NO_MORE_FILES;
1153
+ SetLastError(ERROR_NO_MORE_FILES);
1154
+ end else begin
1155
+
1156
+ FindData := CurrentListing[0 ].ToFindData(RealPath.sharedDir); // folders inside shared links directory must be displayed as symlinks
1157
+ FileCounter := 1 ;
1158
+ if RealPath.sharedDir then
1159
+ Result := FIND_SHARED_LINKS
1160
+ else
1161
+ Result := FIND_OK;
1162
+ end ;
1163
1163
end ;
1164
1164
end ;
1165
1165
end ;
0 commit comments