Skip to content

Commit

Permalink
Fixed Windows miner detection
Browse files Browse the repository at this point in the history
Added Windows, Mac OS to bundler
Added rough rebug log
  • Loading branch information
Donovan Solms committed Apr 23, 2018
1 parent 366b999 commit 53e5b07
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
13 changes: 13 additions & 0 deletions src/bundler.json
@@ -1,5 +1,18 @@
{
"app_name": "Stellite GUI Miner v0.0.1",
"environments": [
{"arch": "amd64", "os": "darwin"},
{"arch": "amd64", "os": "linux"},
{
"arch": "amd64",
"os": "windows",
"env": {
"CC": "x86_64-w64-mingw32-gcc",
"CXX": "x86_64-w64-mingw32-g++",
"CGO_ENABLED": "1"
}
}
],
"icon_path_darwin": "resources/icon.icns",
"icon_path_linux": "resources/icon.png",
"icon_path_windows": "resources/icon.ico",
Expand Down
10 changes: 10 additions & 0 deletions src/gui/gui.go
Expand Up @@ -145,9 +145,19 @@ func New(
TimestampFormat: "Jan 02 15:04:05",
})
logrus.SetLevel(logrus.InfoLevel)

logrus.SetOutput(os.Stdout)
if isDebug {
logrus.SetLevel(logrus.DebugLevel)
// TODO: Handle this debug log better
debugLog, err := os.OpenFile(
fmt.Sprintf(".%c%s", os.PathSeparator, "debug.log"),
os.O_CREATE|os.O_TRUNC|os.O_WRONLY,
0644)
if err != nil {
panic(err)
}
logrus.SetOutput(debugLog)
}
// Setting the WithFields now will ensure all log entries from this point
// includes the fields
Expand Down
11 changes: 9 additions & 2 deletions src/gui/miner/helper.go
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"io/ioutil"
"path/filepath"
"runtime"
"strings"
)

Expand Down Expand Up @@ -74,8 +75,14 @@ func DetermineMinerType(dir string) (string, string, error) {
if file.IsDir() {
continue
}
if strings.Contains(file.Mode().Perm().String(), "x") == false {
continue
if runtime.GOOS == "windows" {
if strings.Contains(strings.ToLower(file.Name()), "exe") == false {
continue
}
} else {
if strings.Contains(file.Mode().Perm().String(), "x") == false {
continue
}
}

fileName := strings.ToLower(file.Name())
Expand Down
5 changes: 3 additions & 2 deletions src/main.go
Expand Up @@ -21,7 +21,7 @@ var BuiltAt string
// main implements the main runnable of the application
func main() {
// Grab the command-line flags
debug := flag.Bool("d", false, "Enabled debug mode")
debug := flag.Bool("d", false, "Enable debug mode")
flag.Parse()

var config *gui.Config
Expand All @@ -36,7 +36,8 @@ func main() {
} else {
config = nil
// Not set yet, set to default
apiEndpoint = "http://stellite.live.local/miner"
//apiEndpoint = "http://stellite.live.local/miner"
apiEndpoint = "https://www.stellite.live/miner"
}

// Create the miner
Expand Down

0 comments on commit 53e5b07

Please sign in to comment.