@@ -2662,7 +2662,7 @@ def wunlink(log: "NamedLogger", abspath: str, flags: dict[str, Any]) -> bool:
2662
2662
return _fs_mvrm (log , abspath , "" , False , flags )
2663
2663
2664
2664
2665
- def get_df (abspath : str , prune : bool ) -> tuple [Optional [ int ], Optional [ int ] , str ]:
2665
+ def get_df (abspath : str , prune : bool ) -> tuple [int , int , str ]:
2666
2666
try :
2667
2667
ap = fsenc (abspath )
2668
2668
while prune and not os .path .isdir (ap ) and BOS_SEP in ap :
@@ -2673,17 +2673,22 @@ def get_df(abspath: str, prune: bool) -> tuple[Optional[int], Optional[int], str
2673
2673
assert ctypes # type: ignore # !rm
2674
2674
abspath = fsdec (ap )
2675
2675
bfree = ctypes .c_ulonglong (0 )
2676
+ btotal = ctypes .c_ulonglong (0 )
2677
+ bavail = ctypes .c_ulonglong (0 )
2676
2678
ctypes .windll .kernel32 .GetDiskFreeSpaceExW ( # type: ignore
2677
- ctypes .c_wchar_p (abspath ), None , None , ctypes .pointer (bfree )
2679
+ ctypes .c_wchar_p (abspath ),
2680
+ ctypes .pointer (bavail ),
2681
+ ctypes .pointer (btotal ),
2682
+ ctypes .pointer (bfree ),
2678
2683
)
2679
- return (bfree .value , None , "" )
2684
+ return (bavail .value , btotal . value , "" )
2680
2685
else :
2681
2686
sv = os .statvfs (ap )
2682
2687
free = sv .f_frsize * sv .f_bfree
2683
2688
total = sv .f_frsize * sv .f_blocks
2684
2689
return (free , total , "" )
2685
2690
except Exception as ex :
2686
- return (None , None , repr (ex ))
2691
+ return (0 , 0 , repr (ex ))
2687
2692
2688
2693
2689
2694
if not ANYWIN and not MACOS :
0 commit comments