feat: add outfit output directory
This commit is contained in:
@@ -91,8 +91,9 @@ def _is_dir_writable(path):
|
||||
return False
|
||||
|
||||
|
||||
# Default export folder name, placed next to Launcher.exe in the packaged layout.
|
||||
# Default export folder names, placed next to Launcher.exe in the packaged layout.
|
||||
_OUTPUT_DIR_NAME = "合并后的图片"
|
||||
_OUTFIT_OUTPUT_DIR_NAME = "穿搭图片"
|
||||
|
||||
|
||||
def get_output_dir():
|
||||
@@ -114,6 +115,28 @@ def get_output_dir():
|
||||
return d
|
||||
|
||||
|
||||
def get_outfit_output_dir():
|
||||
"""Return the default AI outfit output directory as a Path.
|
||||
|
||||
Packaged: <install root>\\穿搭图片 (next to Launcher.exe, not inside app\\).
|
||||
Falls back to <data_dir>/output/穿搭图片 if the preferred location is not
|
||||
writable. Development: <project root>/穿搭图片.
|
||||
|
||||
User-selected outfit_output_dir still takes precedence in the UI.
|
||||
"""
|
||||
if getattr(sys, "frozen", False):
|
||||
candidate = get_app_dir().parent / _OUTFIT_OUTPUT_DIR_NAME
|
||||
else:
|
||||
candidate = get_app_dir() / _OUTFIT_OUTPUT_DIR_NAME
|
||||
|
||||
if _is_dir_writable(candidate):
|
||||
return candidate
|
||||
|
||||
d = get_data_dir() / "output" / _OUTFIT_OUTPUT_DIR_NAME
|
||||
d.mkdir(parents=True, exist_ok=True)
|
||||
return d
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 文件夹扫描
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user