gracefully handles missing CS folder

This commit is contained in:
duncathan 2019-09-11 17:03:27 -06:00
parent 32c080d84d
commit cd55e26160
2 changed files with 10 additions and 2 deletions

View file

@ -38,6 +38,10 @@ function C:setPath(path)
csdirectory = path csdirectory = path
end end
function C:ready()
return csdirectory ~= nil
end
function C:randomize() function C:randomize()
resetLog() resetLog()
logNotice('=== Cave Story Randomizer v' .. VERSION .. ' ===') logNotice('=== Cave Story Randomizer v' .. VERSION .. ' ===')

View file

@ -20,8 +20,12 @@ layout.twitter.text = '(@shruuu and @duncathan_salt)'
layout.footer.text = 'Original randomizer:\r\nshru.itch.io/cave-story-randomizer' layout.footer.text = 'Original randomizer:\r\nshru.itch.io/cave-story-randomizer'
layout.go:onPress(function() layout.go:onPress(function()
C:setStatus(Randomizer:randomize()) if Randomizer:ready() then
Randomizer:new() C:setStatus(Randomizer:randomize())
Randomizer:new()
else
C:setStatus("No Cave Story folder found!\r\nDrag and drop your Cave Story folder here.")
end
end) end)
function C:draw() function C:draw()