浏览代码

Bug 2000: Empty local drive could not be entered

https://winscp.net/tracker/2000
(cherry picked from commit bc689d11d02fec260234096d30d956334fda7bf3)

Source commit: 9f1230b3c2a7bb18064ca706e0640da9269182a9
Martin Prikryl 4 年之前
父节点
当前提交
664784ef76
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      source/packages/filemng/DirView.pas

+ 6 - 2
source/packages/filemng/DirView.pas

@@ -624,13 +624,17 @@ begin
   if not DirectoryExistsFix(Path) then
     raise Exception.CreateFmt(SDirNotExists, [Path]);
   DosError := SysUtils.FindFirst(ApiPath(IncludeTrailingPathDelimiter(Path) + '*.*'), FileAttr, SRec);
-  if DosError = 0 then
+  if DosError = ERROR_SUCCESS then
   begin
     FindClose(SRec);
   end
     else
   begin
-    RaiseLastOSError;
+    // File not found is expected when accessing a root folder of an empty drive
+    if DosError <> ERROR_FILE_NOT_FOUND then
+    begin
+      RaiseLastOSError;
+    end;
   end;
 end;