From 226e9d621069f69a93d68c99e7a050261212fa30 Mon Sep 17 00:00:00 2001 From: Caleb Gardner Date: Thu, 10 Aug 2017 19:05:54 -0500 Subject: [PATCH] Changed $PANAME to $FILENAME Added $APPNAME Fixed a couple bugs --- app.go | 30 +++++++++++++++++++----------- appimg/download.go | 3 +-- main.go | 3 +-- settings.go | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app.go b/app.go index 41befdf..6ae8582 100644 --- a/app.go +++ b/app.go @@ -25,7 +25,11 @@ type app struct { func (a *app) getTreeIter(store *gtk.TreeStore) *gtk.TreeIter { it := store.Append(nil) store.SetValue(it, 0, a.icon) - store.SetValue(it, 1, a.name) + if portableHide { + store.SetValue(it, 1, strings.TrimSuffix(a.name, "Portable")) + } else { + store.SetValue(it, 1, a.name) + } if len(a.ex) > 1 { if wine { for _, v := range a.ex { @@ -48,7 +52,7 @@ func (a *app) launch() { var cmd *exec.Cmd if !contains(a.lin, a.ex[0]) { if comEnbld { - cmd = exec.Command("/bin/sh", "-c", ". PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; wine \""+a.ex[0]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[0]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; wine \""+a.ex[0]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; wine \""+a.ex[0]+"\"") } @@ -58,7 +62,7 @@ func (a *app) launch() { os.Mkdir(a.dir+"/"+a.ex[0]+".config", 0777) } if comEnbld { - cmd = exec.Command("/bin/sh", "-c", ". PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.ex[0]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[0]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.ex[0]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; \"./"+a.ex[0]+"\"") } @@ -73,7 +77,7 @@ func (a *app) launch() { os.Mkdir(a.dir+"/"+a.ex[0]+".config", 0777) } if comEnbld { - cmd = exec.Command("/bin/sh", "-c", "export PANAME="+a.ex[0]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.ex[0]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[0]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.ex[0]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; \"./"+a.ex[0]+"\"") } @@ -86,7 +90,7 @@ func (a *app) launch() { var cmd *exec.Cmd if len(a.lin) == 0 { if comEnbld { - cmd = exec.Command("/bin/sh", "-c", ". PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; wine \""+a.ex[0]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[0]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; wine \""+a.ex[0]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; wine \""+a.ex[0]+"\"") } @@ -103,7 +107,7 @@ func (a *app) launch() { os.Mkdir(a.dir+"/"+a.ex[ind]+".config", 0777) } if comEnbld { - cmd = exec.Command("/bin/sh", "-c", "export PANAME="+a.ex[ind]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.lin[ind]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[ind]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.lin[ind]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; \"./"+a.lin[ind]+"\"") } @@ -126,7 +130,7 @@ func (a *app) launch() { os.Mkdir(a.dir+"/"+a.ex[ind]+".config", 0777) } if comEnbld { - cmd = exec.Command("/bin/sh", "-c", "export PANAME="+a.ex[ind]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.lin[ind]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[ind]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.lin[ind]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; \"./"+a.lin[ind]+"\"") } @@ -143,7 +147,7 @@ func (a *app) launchSub(sub int) { var cmd *exec.Cmd if !contains(a.lin, a.ex[sub]) { if comEnbld { - cmd = exec.Command("/bin/sh", "-c", ". PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; wine \""+a.ex[sub]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[0]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; wine \""+a.ex[sub]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; wine \""+a.ex[sub]+"\"") } @@ -153,7 +157,7 @@ func (a *app) launchSub(sub int) { os.Mkdir(a.dir+"/"+a.ex[sub]+".config", 0777) } if comEnbld { - cmd = exec.Command("/bin/sh", "-c", "export PANAME="+a.ex[sub]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.ex[sub]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[sub]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.ex[sub]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; \"./"+a.ex[sub]+"\"") } @@ -168,7 +172,7 @@ func (a *app) launchSub(sub int) { os.Mkdir(a.dir+"/"+a.ex[sub]+".config", 0777) } if comEnbld { - cmd = exec.Command("/bin/sh", "-c", "export PANAME="+a.ex[sub]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.ex[sub]+"\"") + cmd = exec.Command("/bin/sh", "-c", "export APPNAME="+a.name+";export FILENAME="+a.ex[sub]+";. PortableApps/LinuxPACom/common.sh || exit 1;cd \""+a.dir+"\"; \"./"+a.ex[sub]+"\"") } else { cmd = exec.Command("/bin/sh", "-c", "cd \""+a.dir+"\"; \"./"+a.ex[sub]+"\"") } @@ -203,11 +207,15 @@ func (a *app) edit(parent *gtk.Window, reload func()) { imgBut.SetImage(img) imgBut.SetSizeRequest(100, 100) imgBut.Connect("clicked", func() { - fil, _ := gtk.FileChooserDialogNewWith2Buttons("Select Icon", win, gtk.FILE_CHOOSER_ACTION_OPEN, "Cancel", gtk.RESPONSE_CANCEL, "Open", gtk.RESPONSE_ACCEPT) + fil, _ := gtk.FileChooserDialogNewWith1Button("Select Icon", win, gtk.FILE_CHOOSER_ACTION_OPEN, "Open", gtk.RESPONSE_ACCEPT) filter, _ := gtk.FileFilterNew() filter.AddPixbufFormats() filter.SetName("Supported Pictures") fil.AddFilter(filter) + but, _ := fil.AddButton("Cancel", gtk.RESPONSE_CANCEL) + but.Connect("clicked", func() { + fil.Close() + }) resp := fil.Run() if resp == int(gtk.RESPONSE_ACCEPT) { filename := fil.GetFilename() diff --git a/appimg/download.go b/appimg/download.go index ec60c0c..cd813c1 100644 --- a/appimg/download.go +++ b/appimg/download.go @@ -39,7 +39,6 @@ func downloadApp(parent *gtk.Window, ap appimg) { return nil }, } - fmt.Println(urlBase + ap.full) resp, err := check.Get(urlBase + ap.full) if err != nil { fmt.Println(err) @@ -54,7 +53,7 @@ func downloadApp(parent *gtk.Window, ap appimg) { foldName = "PortableApps/" + name } else { os.Mkdir("PortableApps/"+name+"Portable", 0777) - foldName = "PortableApps/" + name + foldName = "PortableApps/" + name + "Portable" } os.Remove(foldName + "/" + ap.full) fil, err := os.Create(foldName + "/" + ap.full) diff --git a/main.go b/main.go index 8c664c5..a299806 100644 --- a/main.go +++ b/main.go @@ -10,8 +10,7 @@ import ( ) const ( - version = "2.1.2.0" - defIni = "" + version = "2.1.2.1" ) var ( diff --git a/settings.go b/settings.go index 2273c72..5325726 100644 --- a/settings.go +++ b/settings.go @@ -10,7 +10,7 @@ import ( ) const ( - commonHelp = "The common.sh is run before every app is launched and allows you to set variables such as $HOME. For directories, ALWAYS start the directory with $PWD which points to the directory where LinuxPA is. To allow for greater customization and isolation, you can use the $PANAME variable which is the filename of the executable you're using." + commonHelp = "The common.sh is run before every app is launched and allows you to set variables such as $HOME. For directories, ALWAYS start the directory with $PWD which points to the directory where LinuxPA is. To allow for greater customization and isolation, you can use the $FILENAME variable which is the filename of the executable you're using and the $APPNAME variable which is the name of the app being lanched." ) func settingsUI(parent *gtk.Window, onExit func()) {