Skip to content

Commit

Permalink
feat: avoid running new job if one is already running
Browse files Browse the repository at this point in the history
  • Loading branch information
S1M0N38 committed Feb 11, 2024
1 parent fe421a4 commit 787bf0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion lua/love2d/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ end
---@param opts? options: config table
config.setup = function(opts)
config.options = vim.tbl_deep_extend("force", {}, config.defaults, opts or {})

if config.options.path_to_love_library ~= "" then
local library_path = vim.fn.expand(config.options.path_to_love_library)
if vim.fn.isdirectory(library_path) == 0 then
Expand Down
4 changes: 4 additions & 0 deletions lua/love2d/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ end
---Run a Love2D project
---@param path string: The path to the Love2D project
love2d.run = function(path)
if love2d.job and love2d.job.id then
vim.notify("A LÖVE project is already running.", vim.log.levels.WARN)
return
end
love2d.job = {} -- reset job
vim.notify("Running LÖVE project at " .. path)
local cmd = require("love2d.config").options.path_to_love .. " " .. path
Expand Down

0 comments on commit 787bf0d

Please sign in to comment.