Skip to content

fix(export): split exe path from embedded arguments to prevent double-quoting - #36

Open
hikaps wants to merge 4 commits into
developfrom
fix-issue-35-double-quote-path
Open

fix(export): split exe path from embedded arguments to prevent double-quoting#36
hikaps wants to merge 4 commits into
developfrom
fix-issue-35-double-quote-path

Conversation

@hikaps

@hikaps hikaps commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #35 — when a Playnite File action stores the full command line in the Path field (e.g. "C:\Game\game.exe" -arg1 -arg2), the exe and arguments end up bundled in SteamShortcut.Exe. The VDF quoting logic in ToObject then wraps the entire string again, producing double-quoted output like ""C:\Game\game.exe" -arg1 -arg2" which Steam cannot parse.

Root cause

The alreadyQuoted check in ToObject only handled fully-quoted strings (starts AND ends with "). A partially-quoted string like "C:\Game\game.exe" -args passes through and gets wrapped: ""C:\Game\game.exe" -args".

Changes

Three layers of defense:

  1. Utils.SplitExeAndArgs(string) — new helper that detects when a command line has a quoted exe portion followed by arguments, and splits them apart.

  2. CreateOrUpdateShortcut + WriteBackHandler — split exe/args before setting sc.Exe; combine split args with action.Arguments for sc.LaunchOptions. Also fixes appId generation to use the clean exe path.

  3. ToObject() defense-in-depth — even if a partially-quoted exe slips through, extract only the quoted portion instead of re-wrapping the entire string.

Tests

  • SplitExeAndArgs: 7 unit tests covering quoted+args, quoted-only, unquoted, unmatched quotes, whitespace, empty input
  • ToObject: 6 regression tests covering the exact double-quoting scenario, already-quoted, unquoted, unmatched quote, empty/whitespace
  • All existing tests should pass (CI will confirm — can't build WPF+net462 on Linux)

Files

File Change
src/SteamShortcutsImporter/Utils.cs +28 new SplitExeAndArgs
src/SteamShortcutsImporter/ImportExportService.cs +12/-5 split exe/args in export
src/SteamShortcutsImporter/WriteBackHandler.cs +8/-3 split exe/args in write-back
src/SteamShortcutsImporter/ShortcutsFile.cs +18/-3 defense-in-depth + internal → internal
tests/ShortcutsTests/UtilsTests.cs +67 SplitExeAndArgs tests
tests/ShortcutsTests/ShortcutsFileTests.cs new: +67 ToObject regression tests

hikaps added 4 commits August 6, 2026 12:21
…-quoting

When a Playnite File action stores the full command line in the Path
field (e.g. '"C:\Game\game.exe" -arg1 -arg2'), the exe and arguments
end up bundled in the SteamShortcut.Exe field. The ToObject VDF quoting
would then wrap the entire string in quotes, producing double-quoted
output like '""C:\Game\game.exe" -arg1 -arg2"' which Steam cannot
parse.

Fix applies at three levels:
- Utils.SplitExeAndArgs(): new helper extracts the quoted exe portion
  from a command line string
- CreateOrUpdateShortcut + WriteBackHandler: split exe/args before
  setting sc.Exe; combine split args with action.Arguments for
  LaunchOptions
- ToObject(): defense-in-depth guard against partially-quoted strings
  reaching the VDF serializer

Closes #35
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