aboutsummaryrefslogtreecommitdiffstats
path: root/systray_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'systray_windows.go')
-rw-r--r--systray_windows.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/systray_windows.go b/systray_windows.go
index ca42cb9..7630c82 100644
--- a/systray_windows.go
+++ b/systray_windows.go
@@ -6,6 +6,7 @@ import (
"os"
"path/filepath"
"syscall"
+ "runtime"
"unsafe"
"github.com/getlantern/filepersist"
@@ -14,7 +15,9 @@ import (
var (
iconFiles = make([]*os.File, 0)
dllDir = filepath.Join(os.Getenv("APPDATA"), "systray")
- dllFile = filepath.Join(dllDir, "systray.dll")
+ dllFileName = "systray" + runtime.GOARCH + ".dll"
+ dllFile = filepath.Join(dllDir, dllFileName)
+
mod = syscall.NewLazyDLL(dllFile)
_nativeLoop = mod.NewProc("nativeLoop")
@@ -27,19 +30,19 @@ var (
func init() {
// Write DLL to file
- b, err := Asset("systray.dll")
+ b, err := Asset(dllFileName)
if err != nil {
- panic(fmt.Errorf("Unable to read systray.dll: %v", err))
+ panic(fmt.Errorf("Unable to read " + dllFileName + ": %v", err))
}
err = os.MkdirAll(dllDir, 0755)
if err != nil {
- panic(fmt.Errorf("Unable to create directory %v to hold systray.dll: %v", dllDir, err))
+ panic(fmt.Errorf("Unable to create directory %v to hold " + dllFileName + ": %v", dllDir, err))
}
err = filepersist.Save(dllFile, b, 0644)
if err != nil {
- panic(fmt.Errorf("Unable to save systray.dll to %v: %v", dllFile, err))
+ panic(fmt.Errorf("Unable to save " + dllFileName + " to %v: %v", dllFile, err))
}
}