Skip to content

Commit

Permalink
core/plugins: add plugin to add home folder to project
Browse files Browse the repository at this point in the history
  • Loading branch information
takase1121 committed Apr 29, 2024
1 parent 96fb698 commit bf5b91b
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions core/plugins/wasm_add_project_folder.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
--mod-version:3

-- This plugin literally adds the home folder to the project.

local core = require "core"
local connector = require "libraries.connector"

if system.get_file_info(USERDIR .. "/.first") == nil then
local found = false
local home = os.getenv("HOME")
for _, v in ipairs(core.project_directories) do
if v.name == home then
found = true
break
end
end
-- work around old versions that allows duplicate entries
if not found then
core.add_project_directory(os.getenv('HOME'))
end
local f, err = io.open(USERDIR .. "/.first", "w")
if f == nil then
core.error("cannot open file: %s", err)
return
end
f:close()
connector.idbsync_save_sync()
end

0 comments on commit bf5b91b

Please sign in to comment.