Skip to content

Commit

Permalink
Changed $PANAME to $FILENAME
Browse files Browse the repository at this point in the history
Added $APPNAME
Fixed a couple bugs
  • Loading branch information
CalebQ42 committed Aug 11, 2017
1 parent 56748f0 commit 226e9d6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
30 changes: 19 additions & 11 deletions app.go
Expand Up @@ -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 {
Expand All @@ -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]+"\"")
}
Expand All @@ -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]+"\"")
}
Expand All @@ -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]+"\"")
}
Expand All @@ -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]+"\"")
}
Expand All @@ -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]+"\"")
}
Expand All @@ -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]+"\"")
}
Expand All @@ -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]+"\"")
}
Expand All @@ -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]+"\"")
}
Expand All @@ -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]+"\"")
}
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions appimg/download.go
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions main.go
Expand Up @@ -10,8 +10,7 @@ import (
)

const (
version = "2.1.2.0"
defIni = ""
version = "2.1.2.1"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion settings.go
Expand Up @@ -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()) {
Expand Down

0 comments on commit 226e9d6

Please sign in to comment.