Create shortcuts on OSX, return AMD64 on M1 Mac
This commit is contained in:
@ -14,7 +14,6 @@ Plugin:
|
||||
- [i2p.plugins.tor-manager-linux-386](i2p.plugins.tor-manager-linux-386.su3)
|
||||
- [i2p.plugins.tor-manager-windows-amd64](i2p.plugins.tor-manager-windows-amd64.su3)
|
||||
- [i2p.plugins.tor-manager-darwin-arm64](i2p.plugins.tor-manager-darwin-arm64.su3)
|
||||
- [i2p.plugins.tor-manager-linux-arm64](i2p.plugins.tor-manager-linux-arm64.su3)
|
||||
- [i2p.plugins.tor-manager-linux-amd64](i2p.plugins.tor-manager-linux-amd64.su3)
|
||||
- [i2p.plugins.tor-manager-windows-386](i2p.plugins.tor-manager-windows-386.su3)
|
||||
- [i2p.plugins.tor-manager-darwin-amd64](i2p.plugins.tor-manager-darwin-amd64.su3)
|
||||
|
@ -14,7 +14,6 @@
|
||||
<li><a href="i2p.plugins.tor-manager-linux-386.su3">i2p.plugins.tor-manager-linux-386</a></li>
|
||||
<li><a href="i2p.plugins.tor-manager-windows-amd64.su3">i2p.plugins.tor-manager-windows-amd64</a></li>
|
||||
<li><a href="i2p.plugins.tor-manager-darwin-arm64.su3">i2p.plugins.tor-manager-darwin-arm64</a></li>
|
||||
<li><a href="i2p.plugins.tor-manager-linux-arm64.su3">i2p.plugins.tor-manager-linux-arm64</a></li>
|
||||
<li><a href="i2p.plugins.tor-manager-linux-amd64.su3">i2p.plugins.tor-manager-linux-amd64</a></li>
|
||||
<li><a href="i2p.plugins.tor-manager-windows-386.su3">i2p.plugins.tor-manager-windows-386</a></li>
|
||||
<li><a href="i2p.plugins.tor-manager-darwin-amd64.su3">i2p.plugins.tor-manager-darwin-amd64</a></li>
|
||||
|
@ -1,9 +1,55 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"i2pgit.org/idk/i2p.plugins.tor-manager/get"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func GenerateAppArmor() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func CreateShortcuts() error {
|
||||
if err := CreateShortcut("torbrowser"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := CreateShortcut("i2pbrowser"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := CreateShortcut("i2pconfig"); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func CreateShortcut(linkname string) error {
|
||||
// check if there is a symlink in the $HOME/Desktop Directory
|
||||
// if not, create one
|
||||
// if there is, check if it points to the correct location
|
||||
// if not, delete it and create a new one
|
||||
// if there is, do nothing
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
absolutepath, err := filepath.Abs(filepath.Join(filepath.Dir(exe), exe))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
path := filepath.Join(home, "Desktop", linkname)
|
||||
if tbget.FileExists(linkname) {
|
||||
if originfile, err := os.Readlink(path); err != nil || originfile != absolutepath {
|
||||
if err := os.Remove(path); err != nil {
|
||||
return err
|
||||
}
|
||||
return os.Symlink(absolutepath, path)
|
||||
}
|
||||
}
|
||||
return os.Symlink(absolutepath, path)
|
||||
return nil
|
||||
}
|
||||
|
10
main.go
10
main.go
@ -47,14 +47,16 @@ func OS() string {
|
||||
}
|
||||
|
||||
func ARCH() string {
|
||||
// if OS() == "osx" {
|
||||
// return ""
|
||||
// }
|
||||
switch runtime.GOARCH {
|
||||
case "386":
|
||||
return "32"
|
||||
case "amd64":
|
||||
return "64"
|
||||
case "arm64":
|
||||
if OS() == "osx" {
|
||||
return "64"
|
||||
}
|
||||
return ""
|
||||
default:
|
||||
return "unknown"
|
||||
}
|
||||
@ -109,7 +111,7 @@ func main() {
|
||||
} else if filename == "firefox" {
|
||||
log.Println("Starting Firefox")
|
||||
if *profile != "" {
|
||||
*profile = filepath.Join(tbget.WORKING_DIR, "i2p.firefox")
|
||||
*profile = filepath.Join(tbget.WORKING_DIR, "profile.firefox")
|
||||
}
|
||||
log.Println("Using profile", *profile)
|
||||
}
|
||||
|
Reference in New Issue
Block a user