Berserk-Games / atom-tabletopsimulator-lua

Tabletop Simulator scripting package for Atom.
Other
36 stars 27 forks source link

Uncaught Error: ENOENT: no such file or directory, open 'C:\users\steamuser\My Documents/My Games... #129

Open gjkf opened 4 years ago

gjkf commented 4 years ago

[Enter steps to reproduce:]

  1. Run TTS on Proton
  2. Open Atom
  3. Open a game on TTS

Atom: 1.52.0 x64 Electron: 6.1.12 OS: Ubuntu 18.04.5 Thrown From: tabletopsimulator-lua package 12.4.3

Stack Trace

Uncaught Error: ENOENT: no such file or directory, open 'C:\users\steamuser\My Documents/My Games/Tabletop Simulator/Saves\TS_Save_1.json'

At fs.js:126

Error: ENOENT: no such file or directory, open 'C:\users\steamuser\My Documents/My Games/Tabletop Simulator/Saves\TS_Save_1.json'
    at Object.openSync (fs.js:447:3)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as openSync] (electron/js2c/asar.js:138:31)
    at Object.readFileSync (fs.js:349:35)
    at Object.fs.readFileSync (electron/js2c/asar.js:580:40)
    at Object.fs.readFileSync (electron/js2c/asar.js:580:40)
    at Object.parseSavePath (/packages/tabletopsimulator-lua/lib/tabletopsimulator-lua.coffee:1867:26)
    at handleMessage (/packages/tabletopsimulator-lua/lib/tabletopsimulator-lua.coffee:1887:12)
    at /packages/tabletopsimulator-lua/lib/tabletopsimulator-lua.coffee:2114:9)
    at Socket.emit (events.js:200:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:166:17)

Commands

     -0:22.8.0 tabletopsimulator-lua:getObjects (ul.list-inline.tab-bar.inset-panel)

Non-Core Packages

tabletopsimulator-lua 12.4.3 

Extra info: I run TTS on Proton 5.0-9 on Steam installed via flatpak. After some searching and some luck, it appears that the save is located in /home/cossu/.var/app/com.valvesoftware.Steam/data/Steam/steamapps/compatdata/286160/pfx/dosdevices/c:/users/steamuser/My Documents/My Games/Tabletop Simulator/Saves

ikegami commented 4 years ago

Upon loading or saving a game, TTS sends the following message to Atom:

{
  "messageID": 1,
  "scriptStates": [ ... ],
  "savePath": "C:\\users\\steamuser\\Documents//My Games//Tabletop Simulator//Saves\\TS_Save_1.json"
}

or

{
  "messageID": 6,
  "savePath": "C:\\users\\steamuser\\Documents//My Games//Tabletop Simulator//Saves\\TS_Save_1.json"
}

The path is not valid as mentioned at the bottom of the OP.

If I'm not mistaken parseSavePath extract information for Generate GUID code. (Anything else?). If that stopped working for the petitioner, it wouldn't be the end of the world. But the petitioner has stated on Discord that this error prevents them from even seeing the files in Atom.

It seems to me this could be avoided by catching exceptions from parseSavePath and displaying a friendly warning rather than making the whole plugin unusable.