Skip to content
Snippets Groups Projects
Unverified Commit eef31529 authored by azubieta's avatar azubieta
Browse files

add Registry Lookup

parent 3713e99d
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ func (cmd *RemoveCmd) Run(*Context) (err error) { ...@@ -22,7 +22,7 @@ func (cmd *RemoveCmd) Run(*Context) (err error) {
} }
registry.Update() registry.Update()
fileName, ok := cmd.lookupFileName(registry) fileName, ok := registry.Lookup(cmd.Id)
if !ok { if !ok {
fileName = cmd.Id fileName = cmd.Id
} }
...@@ -50,16 +50,6 @@ func (cmd *RemoveCmd) Run(*Context) (err error) { ...@@ -50,16 +50,6 @@ func (cmd *RemoveCmd) Run(*Context) (err error) {
return err return err
} }
func (cmd *RemoveCmd) lookupFileName(registry *utils.Registry) (string, bool) {
for fileName, entry := range registry.Entries {
if entry.Id == cmd.Id {
return fileName, true
}
}
return "", false
}
func uninstallAppImage(filePath string) error { func uninstallAppImage(filePath string) error {
lib, err := dl.Open("libappimage.so", 0) lib, err := dl.Open("libappimage.so", 0)
if err != nil { if err != nil {
......
...@@ -111,6 +111,16 @@ func (registry *Registry) Update() { ...@@ -111,6 +111,16 @@ func (registry *Registry) Update() {
} }
} }
func (registry *Registry) Lookup(id string) (string, bool) {
for fileName, entry := range registry.Entries {
if entry.Id == id {
return fileName, true
}
}
return "", false
}
func getFileSha1Checksum(fileName string) (string, error) { func getFileSha1Checksum(fileName string) (string, error) {
applicationsDir, err := MakeApplicationsDirPath() applicationsDir, err := MakeApplicationsDirPath()
if err != nil { if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment