feat: enhance downloader to support directory structures #2701
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Enhanced the auto-updater downloader to use zip-based downloads with Python-only file copying for maximum safety. This naturally supports directory structures while preserving all user configurations.
Problem Solved
utils/*
files inPREDBAT_FILES
before they existconfig/apps.yaml
Solution: Safe Zip + Python-Only
Changed to zip-based downloads with selective Python file copying:
*.py
files (never config, cache, or other files)utils/*.py
filesChanges Made
predbat_update_download_zip()
: Downloads full repo zip*.py
files from extracted ziputils/
and copiesutils/*.py
filesKey Safety Features
✅ Preserves user configs: Never touches
config/apps.yaml
or other settings✅ Python code only: Only
*.py
files get updated✅ No overwrites: Ignores
.bak
, cache, and development files✅ Directory structure: Automatically creates
utils/
for OO managers✅ Future-proof: Any new
*.py
files or directories work automaticallyWhat Gets Copied
*.py
files:predbat.py
,config.py
,utils.py
, etc.*.py
files:utils/battery_manager.py
, etc.utils/
as neededWhat Gets Ignored (for safety)
config/apps.yaml
(user settings preserved)__pycache__/
,.ruff_cache/
(development artifacts).bak
,.git
files (backup/development files)How It Works
https://github.com/springfall2008/batpred/archive/refs/tags/v8.25.1.zip
*.py
files fromapps/predbat/
and subdirectoriesImpact
This addresses the safety concern while enabling directory support for the OO architecture.
🤖 Generated with Claude Code