瀏覽代碼

Bug 2000: Empty local drive could not be entered

https://winscp.net/tracker/2000

Source commit: 1bd3555449b07b34da9416c06b55405e07731949
Martin Prikryl 4 年之前
父節點
當前提交
bc689d11d0
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      source/packages/filemng/DirView.pas

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

@@ -626,13 +626,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;