Get optimal file system buffer size (in bytes) for I/O calls
(path)
| 312 | |
| 313 | |
| 314 | def fsbsize(path): |
| 315 | """ |
| 316 | Get optimal file system buffer size (in bytes) for I/O calls |
| 317 | """ |
| 318 | path = fs_encode(path) |
| 319 | |
| 320 | if os.name == "nt": |
| 321 | import ctypes |
| 322 | |
| 323 | drive = "%s\\" % os.path.splitdrive(path)[0] |
| 324 | cluster_sectors, sector_size = ctypes.c_longlong(0) |
| 325 | |
| 326 | ctypes.windll.kernel32.GetDiskFreeSpaceW(ctypes.c_wchar_p(drive), |
| 327 | ctypes.pointer(cluster_sectors), |
| 328 | ctypes.pointer(sector_size), |
| 329 | None, |
| 330 | None) |
| 331 | return cluster_sectors * sector_size |
| 332 | |
| 333 | else: |
| 334 | return os.statvfs(path).f_frsize |
| 335 | |
| 336 | |
| 337 | def uniqify(seq): |
no test coverage detected