Skip to content

Commit 5f2a4c1

Browse files
committed
optimize d2x pkgindex repo, avoid install dir issue for new xlings version (auto .stamp)
1 parent ea49f0c commit 5f2a4c1

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

template.lua

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,25 @@ function installed()
2828
end
2929

3030
function install()
31-
local dest = d2x_projectdir()
32-
os.cp(projectdir, dest)
31+
os.cp(projectdir, pkginfo.install_dir())
3332
os.tryrm(projectdir)
33+
return true
34+
end
35+
36+
function config()
37+
local dest = d2x_projectdir()
38+
if os.isdir(dest) then
39+
log.warn("Course '%s' is already installed at '%s', skipping config", package.name, dest)
40+
return true
41+
end
42+
os.cp(path.join(pkginfo.install_dir(), projectdir), dest)
3443
os.cd(dest)
3544
system.exec("xlings install")
3645
return true
3746
end
3847

3948
function uninstall()
40-
os.tryrm(d2x_projectdir())
49+
-- TODO: system.rundir() return '' when called from uninstall hook, so we can't reliably find the installed course dir to remove it.
50+
--os.tryrm(d2x_projectdir())
4151
return true
4252
end

0 commit comments

Comments
 (0)