Skip to content
This repository has been archived by the owner on Sep 12, 2021. It is now read-only.

Commit

Permalink
Add fyne-cross stuff into gitignore and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Dec 23, 2019
1 parent 37194ea commit ddcab12
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@
*.dll
*.so
*.dylib

# Produced by a regular go build inside src.
src/src

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Files created and used when using fyne-cross
fyne.syso
*.tar.gz
*.tar.xz
*.app
src/usr
build
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,28 @@
Sparta, a Sport and Rehearsal Tracking Application with a focus for privacy and security.
The application uses encryption and locally stored files to keep your activities private and hidden from spying eyes.

## Cross compiling using fyne-cross
Run the following command from the root of the repo:
```bash
sudo ../../bin/fyne-cross --targets=windows/amd64,darwin/amd64,linux/amd64 --output=sparta ./src/
```

## Packaging the logo
Run the following command for bundling the icon in a windows binary:
```bash
(cd src && ../../../bin/fyne package -icon ../assets/bundled-logo.png -executable ../sparta-windows-amd64.exe -os windows -name sparta)
```

Run the following command for bundling the icon in a macos binary:
```bash
(cd src && ../../../bin/fyne package -icon ../assets/bundled-logo.png -executable ../sparta-darwin-amd64 -os darwin -name sparta)
```

Run the following command for bundling the icon in a linux binary and installer:
```bash
(cd src && ../../../bin/fyne package -icon ../assets/bundled-logo.png -executable ../sparta-linux-amd64 -os linux -name sparta)
```

## Folder structure:
- assets/ : Storage of icons used in the project.
- src/ : The place where all application code is placed and home of the simple main.go file.
Expand Down
33 changes: 29 additions & 4 deletions src/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"runtime"
"sparta/src/file/encrypt"
"strconv"
"time"
Expand All @@ -32,12 +33,36 @@ type Exercise struct {

// Config returns the config directory and handles the error accordingly.
func config() string {
directory, err := os.UserConfigDir()
if err != nil {
fmt.Print(err)
var dir string

// Workaround golang 1.12 in the cross compiling tool.
switch runtime.GOOS {
case "windows":
dir = os.Getenv("AppData")

case "darwin":
dir = os.Getenv("HOME")
dir += "/Library/Preferences"

default: // Unix
dir = os.Getenv("XDG_CONFIG_HOME")
if dir == "" {
dir = os.Getenv("HOME")
dir += "/.config"
}
}

return directory
return dir

/*
directory, err := os.UserConfigDir()
if err != nil {
fmt.Print(err)
}
return directory
*/
}

// DataFile specifies the loacation of our data file.
Expand Down

0 comments on commit ddcab12

Please sign in to comment.