|
|
|
@ -41,11 +41,6 @@ var (
|
|
|
|
ProgramConfig Config
|
|
|
|
ProgramConfig Config
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func print_fatal_error(err ...string) {
|
|
|
|
|
|
|
|
fmt.Fprintln(os.Stderr, err)
|
|
|
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func ReadConfig(filename string) (Config, error) {
|
|
|
|
func ReadConfig(filename string) (Config, error) {
|
|
|
|
config := &Config{}
|
|
|
|
config := &Config{}
|
|
|
|
|
|
|
|
|
|
|
|
@ -335,7 +330,7 @@ func main() {
|
|
|
|
fmt.Println("Creating config file:", configFile)
|
|
|
|
fmt.Println("Creating config file:", configFile)
|
|
|
|
f, err := os.Create(configFile)
|
|
|
|
f, err := os.Create(configFile)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
print_fatal_error("Failed to create config file")
|
|
|
|
panic("Failed to create config file")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Println("Created config file:", configFile)
|
|
|
|
fmt.Println("Created config file:", configFile)
|
|
|
|
|
|
|
|
|
|
|
|
@ -343,7 +338,7 @@ func main() {
|
|
|
|
_, err = f.WriteString(DEFAULT_CONFIG_FILE)
|
|
|
|
_, err = f.WriteString(DEFAULT_CONFIG_FILE)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
f.Close()
|
|
|
|
f.Close()
|
|
|
|
print_fatal_error("Failed to write to config file: ", configFile)
|
|
|
|
panic("Failed to write to config file: " + configFile)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
f.Close()
|
|
|
|
f.Close()
|
|
|
|
|
|
|
|
|
|
|
|
@ -353,7 +348,7 @@ func main() {
|
|
|
|
var err error
|
|
|
|
var err error
|
|
|
|
ProgramConfig, err = ReadConfig(configFile)
|
|
|
|
ProgramConfig, err = ReadConfig(configFile)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
print_fatal_error("Failed to read config file")
|
|
|
|
panic("Failed to read config file")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ProgramConfig.imageLocation = appDirectory + "Eye-Reminder-Icon.png"
|
|
|
|
ProgramConfig.imageLocation = appDirectory + "Eye-Reminder-Icon.png"
|
|
|
|
@ -362,7 +357,7 @@ func main() {
|
|
|
|
DownloadFile(ProgramConfig.imageLocation, EYE_REMINDER_ICON_URL)
|
|
|
|
DownloadFile(ProgramConfig.imageLocation, EYE_REMINDER_ICON_URL)
|
|
|
|
fmt.Println("Downloaded icon")
|
|
|
|
fmt.Println("Downloaded icon")
|
|
|
|
} else if err != nil {
|
|
|
|
} else if err != nil {
|
|
|
|
print_fatal_error("Failed to check if ", ProgramConfig.imageLocation, " exists.")
|
|
|
|
panic("Failed to check if " + ProgramConfig.imageLocation + " exists.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
systrayOnExit := func() {
|
|
|
|
systrayOnExit := func() {
|
|
|
|
|