Skip to content

Improve missing file auto-location for moved project assets#5949

Open
HendrikZA wants to merge 1 commit into
OpenShot:developfrom
HendrikZA:fix/missing-file-autolocate
Open

Improve missing file auto-location for moved project assets#5949
HendrikZA wants to merge 1 commit into
OpenShot:developfrom
HendrikZA:fix/missing-file-autolocate

Conversation

@HendrikZA
Copy link
Copy Markdown

@HendrikZA HendrikZA commented Mar 4, 2026

Summary

This PR improves missing-file resolution during project open/import by adding lightweight path heuristics before prompting the user.

Problem

When assets are moved (commonly into standard home folders), OpenShot often prompts repeatedly to locate missing files even when valid files exist in obvious locations.

Repro (before vs after)

  1. Create/open a project that references media from absolute paths under ~/Pictures or ~/Downloads.
  2. Move the project folder and media (or restore on another machine/home path layout).
  3. Re-open the project.

Before:

  • Repeated “Locate Missing Files” prompts for many assets.

After:

  • Existing files in common home folders are auto-resolved first.
  • Prompt appears only for truly unresolved paths.

Changes

  • Initialize known_paths with common user media folders under home:
    • ~/Downloads, ~/Pictures, ~/Videos, ~/Music, ~/Documents (when present)
  • Add _candidate_paths(file_path):
    • Re-check filename in known paths
    • Use original missing path hints (folder segments) to generate likely absolute candidates
  • In find_missing_file():
    • Try heuristic candidates first
    • If a candidate exists, auto-resolve and continue without prompting
    • Fall back to existing prompt flow unchanged if no candidate exists

Why this is safe

  • Only resolves to paths that actually exist (os.path.exists()).
  • No destructive actions.
  • No behavior change for already-valid paths.
  • Existing dialog/fallback behavior remains intact when heuristics fail.

User impact

  • Fewer startup/import interruptions for relocated assets.
  • Better out-of-the-box recovery of moved project media.
  • Reduced manual “Locate Missing Files” prompts.

Manual test notes

  • Tested with projects containing relocated media assets in home subfolders.
  • Missing references were auto-resolved where files existed.
  • Prompt behavior remained available for unresolved cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant