feat(remove.go): removes .desktop files
This commit is contained in:
parent
4d3ec3135e
commit
2d5a992404
1 changed files with 10 additions and 0 deletions
10
remove.go
10
remove.go
|
@ -22,6 +22,7 @@ func removeMap(conn net.Conn, instance string, objmap map[string]interface{}) er
|
||||||
}
|
}
|
||||||
|
|
||||||
func remove(conn net.Conn, instance string, program string, keep_data bool) error {
|
func remove(conn net.Conn, instance string, program string, keep_data bool) error {
|
||||||
|
|
||||||
package_path, err := filepath.Abs(filepath.Join(instance, "apps", program))
|
package_path, err := filepath.Abs(filepath.Join(instance, "apps", program))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -29,6 +30,7 @@ func remove(conn net.Conn, instance string, program string, keep_data bool) erro
|
||||||
if exists, err := path_exists(package_path); !exists || err != nil {
|
if exists, err := path_exists(package_path); !exists || err != nil {
|
||||||
return errors.New("package not found")
|
return errors.New("package not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.RemoveAll(package_path)
|
err = os.RemoveAll(package_path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -41,5 +43,13 @@ func remove(conn net.Conn, instance string, program string, keep_data bool) erro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
desktop_path, err := filepath.Abs(filepath.Join(instance, "exec", "desktop", program+".desktop"))
|
||||||
|
if exists, err := path_exists(desktop_path); exists && err == nil {
|
||||||
|
err = os.Remove(desktop_path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue