build: 增加 exe 打包脚本与版本信息,修复子目录卷信息查询
- tools/build_exe.ps1:一条命令出 dist\\U盘备份工具.exe(onefile/windowed/图标/版本信息),并打印 SHA-256 - tools/version_info.txt:2.1.0.0 版本资源 - get_volume_info 统一换算到卷根再查询:传子目录/文件也能拿到文件系统,修复 FAT32 4GB 上限与脏卷提示依赖 vol['fs'] 失效的问题 - 新增 2 项体积/卷信息测试(共 32 项)
This commit is contained in:
1 parent
8232b18c9f
commit
550bfaaa00
5 files changed
+106
-9
No files matched your search
+9
-3
@@ -148,10 +148,16 @@ def _hash_file(path, buf=HASH_BUF):
|
||||
|
||||
|
||||
# ---------- 卷信息 / 脏卷检测 / 落盘 ----------
|
||||
def get_volume_info(drive):
|
||||
"""返回 dict(fs=..., label=..., total=..., free=..., serial=...)"""
|
||||
def get_volume_info(path):
|
||||
"""返回 dict(fs=..., label=..., total=..., free=..., serial=...)
|
||||
|
||||
传目录或文件路径都可以:内部统一换算成卷根再查询(GetVolumeInformationW
|
||||
只接受卷根,传子目录会失败,会让 FAT32 4G 上限等判断失效)。
|
||||
"""
|
||||
info = {"fs": "", "label": "", "total": 0, "free": 0, "serial": 0}
|
||||
root = drive if drive.endswith("\\") else drive + "\\"
|
||||
abs_path = os.path.abspath(_plain(path)) if path else ""
|
||||
drive = os.path.splitdrive(abs_path)[0]
|
||||
root = (drive + "\\") if drive else (abs_path if abs_path.endswith("\\") else abs_path + "\\")
|
||||
try:
|
||||
label = ctypes.create_unicode_buffer(261)
|
||||
fsname = ctypes.create_unicode_buffer(261)
|
||||
|
||||
Reference in new issue
Block a user