\db_path style

This commit is contained in:
Burgess Leo
2025-05-22 17:21:44 +08:00
parent 3347abe02f
commit d2a3a7b5b5
9 changed files with 301 additions and 111 deletions

View File

@@ -1,12 +1,9 @@
import os
def ExtractVolumeLetter(path: str) -> str:
"""从绝对路径中提取盘符"""
drive = os.path.splitdrive(path)[0]
if not drive:
raise ValueError(f"无法从路径中提取盘符:{path}")
return drive[0].upper() # 返回 'Y'
def GetVolumeLetter() -> str:
from ntfs_utils.main import volume_letter
return volume_letter
def CopySingleFragmentFiles(source_data_dict, target_path):
@@ -29,7 +26,7 @@ def CopySingleFragmentFiles(source_data_dict, target_path):
print("错误:缺少必要的文件信息")
return
source_disk_path = ExtractVolumeLetter(absolute_path)
source_disk_path = GetVolumeLetter()
target_file_path = os.path.join(target_path, file_name)
try:
@@ -105,7 +102,7 @@ def CopyMultiFragmentFiles(
start_byte = item['start_byte']
length_byte = item['length']
volume_letter = ExtractVolumeLetter(item['absolute_path'])
volume_letter = GetVolumeLetter()
# 读取分片内容
fragment_content = ReadDiskBytes(volume_letter, start_byte, length_byte)