Skip to content

Commit

Permalink
Duuuh atom 1.19 isn't out yet...
Browse files Browse the repository at this point in the history
Issue Berserk-Games#11 isn't actually a problem yet because atom is still only on version 1.18.

Amended code to check atom version; when they update to 1.19 we should be covered.
  • Loading branch information
onelivesleft committed Aug 4, 2017
1 parent 34bf65c commit 2f704df
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/tabletopsimulator-lua.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ serverport = 39998

ttsLuaDir = path.join(os.tmpdir(), "TabletopSimulator", "Lua")

# Check atom version; if 1.19+ then editor.save has become async
# TODO when 1.19 has been out long enough remove this check and require atom 1.19 in package.json
async_save = true
try
if parseFloat(atom.getVersion()) < 1.19
async_save = false
catch error

# Store cursor positions between loads
cursors = {}

Expand Down Expand Up @@ -294,7 +302,10 @@ module.exports = TabletopsimulatorLua =
cursors[editor.getPath()] = editor.getCursorBufferPosition()
catch error
try
await editor.save()
if async_save
await editor.save()
else
editor.save()
catch error

# Read all files into JSON object
Expand Down

0 comments on commit 2f704df

Please sign in to comment.