jh
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional
|
||||
from SYS.logger import log
|
||||
@@ -22,6 +23,12 @@ def global_config() -> List[Dict[str, Any]]:
|
||||
"label": "Debug Output",
|
||||
"default": "false",
|
||||
"choices": ["true", "false"]
|
||||
},
|
||||
{
|
||||
"key": "auto_update",
|
||||
"label": "Auto-Update",
|
||||
"default": "true",
|
||||
"choices": ["true", "false"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -185,7 +192,7 @@ def parse_conf_text(text: str, *, base: Optional[Dict[str, Any]] = None) -> Dict
|
||||
"""Parse a lightweight .conf format into the app's config dict.
|
||||
|
||||
Supported patterns:
|
||||
- Top-level key/value: temp="C:\\Users\\Me\\Downloads"
|
||||
- Top-level key/value: temp="./temp"
|
||||
- Sections: [store=folder] + name/path lines
|
||||
- Sections: [store=hydrusnetwork] + name/access key/url lines
|
||||
- Sections: [provider=OpenLibrary] + email/password lines
|
||||
@@ -447,7 +454,7 @@ def resolve_output_dir(config: Dict[str, Any]) -> Path:
|
||||
Priority:
|
||||
1. config["temp"] - explicitly set temp/output directory
|
||||
2. config["outfile"] - fallback to outfile setting
|
||||
3. Home/Videos - safe user directory fallback
|
||||
3. System Temp - default fallback directory
|
||||
|
||||
Returns:
|
||||
Path to output directory
|
||||
@@ -471,8 +478,8 @@ def resolve_output_dir(config: Dict[str, Any]) -> Path:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fallback to user's Videos directory
|
||||
return Path.home() / "Videos"
|
||||
# Fallback to system temp directory
|
||||
return Path(tempfile.gettempdir())
|
||||
|
||||
|
||||
def get_local_storage_path(config: Dict[str, Any]) -> Optional[Path]:
|
||||
|
||||
Reference in New Issue
Block a user