Some refinement

Moved more complex appimage stuff to seperate package (github.com/CalebQ42/GoAppImage)
Moved settings to a seperate file for organization
Some work to allow asyncronouse app loading (Since goappimage is super slow)
Comments to show what's going to be there in the future.
This commit is contained in:
Caleb
2018-06-14 02:30:59 -05:00
parent c442ef5688
commit ec4d66f6b2
4 changed files with 111 additions and 165 deletions
+33 -17
View File
@@ -2,6 +2,7 @@ package main
import (
"bufio"
"encoding/json"
_ "image/png"
"os"
"os/exec"
@@ -9,6 +10,7 @@ import (
"sort"
"strings"
"github.com/CalebQ42/GoAppImage"
"github.com/gotk3/gotk3/gdk"
"github.com/gotk3/gotk3/gtk"
)
@@ -64,28 +66,12 @@ func setup() {
}
}
}
populated = true
}
func processApp(fold string) (out app) {
wd, _ := os.Getwd()
out.dir = wd + "/" + fold
out.ini = findInfo(fold)
if out.ini != nil {
out.name = getName(out.ini)
out.ini = findInfo(fold)
out.cat = getCat(out.ini)
out.ini = findInfo(fold)
}
if out.name == "" {
out.name = strings.TrimPrefix(fold, "PortableApps/")
}
if out.cat == "" {
out.cat = "Other"
}
if portableHide {
out.name = strings.TrimSuffix(out.name, "Portable")
}
out.icon = getIcon(fold)
folder, _ := os.Open(fold)
fis, _ := folder.Readdirnames(-1)
for _, v := range fis {
@@ -116,6 +102,36 @@ func processApp(fold string) (out app) {
out.name += " (Wine)"
out.wine = true
}
out.icon = getIcon(fold)
if len(out.appimg) > 0 {
os.Mkdir(out.dir+"/.appimageconfig", 0777)
fil, err := os.Open(out.dir + "/.appimageconfig/info.json")
if err == os.ErrNotExist {
fil, _ = os.Create(out.dir + "/.appimageconfig/info.json")
ai := goappimage.NewAppImage(out.dir + "/" + out.appimg[0])
ai.ExtractDesktop(out.dir + "/.appimageconfig/the.desktop")
//extract desktop and parse info then send to json
//also md5 so when updating happens it can update the desktop file
ai.Free()
} else {
//decode json, check if desktop needs to be updated
}
//Parse extracted desktop file
}
out.ini = findInfo(fold)
if out.ini != nil {
out.name = getName(out.ini)
out.cat = getCat(out.ini)
}
if out.name == "" {
out.name = strings.TrimPrefix(fold, "PortableApps/")
}
if out.cat == "" {
out.cat = "Other"
}
if portableHide {
out.name = strings.TrimSuffix(out.name, "Portable")
}
return
}