Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Unable to read shortcuts.vdf #7

Open
WillsterJohnson opened this issue Jun 13, 2023 · 0 comments
Open

[bug] Unable to read shortcuts.vdf #7

WillsterJohnson opened this issue Jun 13, 2023 · 0 comments

Comments

@WillsterJohnson
Copy link

Steps to reproduce

  1. Identify your user id.
  2. Run the command shown below these steps
  3. Observe syntax error

Command (replace <your-id-here> with your id):

npm init && npm i vdf-parser && echo "require(\"vdf-parser\").parse(require(\"node:fs\").readFileSync(\"$HOME/.local/share/Steam/userdata/<your-id-here>/config/shortcuts.vdf\",\"utf-8\"))" | node

As JS file:

const fs = require("node:fs");
const vdf = require("vdf-parser");

vdf.parse(fs.readFileSync("/home/<your-user-name>/.local/share/Steam/userdata/<your-id-here>/config/shortcuts.vdf","utf-8"))

Output:

/.../node_modules/.pnpm/[email protected]/node_modules/vdf-parser/main.js:114
                throw new SyntaxError("VDF.parse: invalid syntax on line " + (i+1) + ":\n" + line);
                ^

SyntaxError: VDF.parse: invalid syntax on line 1:
shortcuts0appid�B��AppNameMO2 -SkyrimExe"/<path-here>/steamapps/compatdata/489830/pfx/drive_c/Modding/MO2/ModOrganizer.exe"StartDir
    at Object.parse (/.../node_modules/.pnpm/[email protected]/node_modules/vdf-parser/main.js:114:23)
    at [stdin]:1:23
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:307:38)
    at node:internal/process/execution:79:19
    at [stdin]-wrapper:6:22
    at evalScript (node:internal/process/execution:78:60)
    at node:internal/main/eval_stdin:30:5
    at Socket.<anonymous> (node:internal/process/execution:195:5)
    at Socket.emit (node:events:525:35)

Node.js v18.16.0

Additional info

The encoding is listed as data for this file. None of the available encodings in fs.readFileSync alter the behavior.

I have not manually modified this file other than the intended use of adding a non-steam game via the steam app.

Copy-pasting the file content into a string does not work due to octal sequences, escaping them returns to the initial error.

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

No branches or pull requests

1 participant