small fixes
This commit is contained in:
@@ -540,6 +540,7 @@ func Install(packagepath string, serial uint) error {
|
|||||||
|
|
||||||
L.SetGlobal("packets_package_dir", lua.LString(cfg.Config.DataDir))
|
L.SetGlobal("packets_package_dir", lua.LString(cfg.Config.DataDir))
|
||||||
L.SetGlobal("packets_bin_dir", lua.LString(cfg.Config.BinDir))
|
L.SetGlobal("packets_bin_dir", lua.LString(cfg.Config.BinDir))
|
||||||
|
L.SetField(L.GetGlobal("os"), "remove", L.NewFunction(internal.SafeRemove))
|
||||||
|
|
||||||
if err := L.DoFile(manifest.Hooks.Install); err != nil {
|
if err := L.DoFile(manifest.Hooks.Install); err != nil {
|
||||||
log.Panic(err)
|
log.Panic(err)
|
||||||
|
|||||||
@@ -188,8 +188,8 @@ func IsSafe(str string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func safeRemove(L *lua.LState) int {
|
func SafeRemove(L *lua.LState) int {
|
||||||
path := L.ToString(1)
|
path := L.CheckString(1)
|
||||||
if !IsSafe(path) {
|
if !IsSafe(path) {
|
||||||
L.Push(lua.LFalse)
|
L.Push(lua.LFalse)
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user