Skip to content

Port upstream #133: a title run by its file name alone gets its own folder as G: - #39

Merged
DesertGamer merged 1 commit into
DesertGamer:mainfrom
lcg007xd-c:port/upstream-133-empty-title-folder
Nov 25, 2026
Merged

DesertGamer merged 1 commit into
DesertGamer:mainfrom
lcg007xd-c:port/upstream-133-empty-title-folder

Conversation

@lcg007xd-c

@lcg007xd-c lcg007xd-c commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

This ports Marvisak/VIctory#133 by Duff. It is cherry-picked with -x, so the commit keeps their authorship.

viport run <title>.exe, run from the game's own folder, gives an exe path with an empty parent. apps/viport/src/run.rs takes exe.parent(), which is Some(""), as the title's folder. When no game_dir is configured, that folder is mounted as G: (content_dir falls back to title_dir). In crates/viport-hle/src/modules/files.rs, root_wide calls std::path::absolute(root), which fails for an empty path, and the error is swallowed. The root stays empty, so G:\x64\a.rpf becomes \x64\a.rpf: the root of the current drive. The title then finds none of its files. Passing a path that includes a folder works.

The fix treats an empty root as ., which is what an empty folder means everywhere else. #133's test comes with it.

VIPort has the upstream merge of #133 in its history, but the change is not in the tree. It was lost in a later merge.

Checked

  • No game data of any kind (files, extracts, screenshots, dumps, saves): see docs/asset-policy.md
  • No binary files or archives
  • No new dependency, build.rs, git hook, .cargo config, CI change or script (or an issue explains why)
  • No download, no started program, no network connection added (or an issue explains why)
  • cargo test --workspace passes (not run, see below)
  • cargo clippy --workspace --all-targets --locked -- -D warnings passes (for viport-hle, with CI: clear the clippy errors that keep main red since a3e7f17 #21 merged in locally)
  • The code I wrote is formatted with rustfmt; I did not reformat lines I did not change

What I ran

The standard-library behaviour the bug rests on, checked on Linux. The same functions behave the same on Windows:

Path::new("GTA6.exe").parent()     = Some("")
std::path::absolute("")            = Err("cannot make an empty path absolute")
std::path::absolute(".").is_ok()   = true

cargo clippy -p viport-hle --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings, with #21 merged in: clean.

Not run: cargo test -p viport-hle (Windows only), or the game. The new test, an_empty_root_is_the_current_directory, will run in the Windows CI test step.

Overlaps

None. No open PR touches viport-hle/src/modules/files.rs.

🤖 Generated with Claude Code

`victory run GTA6.exe`, run from the game folder, gives an exe path with
an empty parent, and that empty folder was mounted as G:. An empty path
cannot be made absolute, so the root stayed empty and G:\x64\a.rpf
became \x64\a.rpf: the root of the current drive. The title then found
none of its files.

An empty root is now the current directory, which is what an empty
folder means everywhere else (`Path::new("").join("x")` is `x` in the
current directory). Passing a path with a folder in it is unaffected.

(cherry picked from commit 01ae55a)
@DesertGamer
DesertGamer merged commit a580b61 into DesertGamer:main Nov 25, 2026
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.

3 participants