Skip to content

Commit

Permalink
fix darwin run without config
Browse files Browse the repository at this point in the history
  • Loading branch information
mpkondrashin committed Feb 19, 2024
1 parent 42b5b88 commit c5216df
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
run: Get-ChildItem -Recurse | Format-Table -Property Mode, LastWriteTime, Length, FullName

- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.21.5

Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:
run: ls -lR

- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.21.5

Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
run: ls -lR

- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.21.5

Expand Down
24 changes: 19 additions & 5 deletions cmd/sandboxer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Sandboxer main file
package main

import (
"errors"
"fmt"
"os"
"os/signal"
Expand Down Expand Up @@ -43,8 +44,8 @@ type SandboxerApp struct {

submissionsWindow *ModalWindow
//quotaWindow *QuotaWindow
//optionsWindow *OptionsWindow
updateWindow *ModalWindow
optionsWindow *ModalWindow
updateWindow *ModalWindow
//aboutWindow *AboutWindow
}

Expand Down Expand Up @@ -79,13 +80,13 @@ func NewSandboxingApp(conf *config.Configuration, channels *task.Channels, list
}, a.optionsWindow.win)
})
*/
optionsWindow := NewModalWindow(NewOptionsWindow(conf), &a.TrayApp)
a.optionsWindow = NewModalWindow(NewOptionsWindow(conf), &a.TrayApp)

a.menu = fyne.NewMenu(globals.AppName,
// SUBMIT_FILE s.submitMenuItem,
a.submissionsWindow.MenuItem,
quotaWindow.MenuItem,
optionsWindow.MenuItem,
a.optionsWindow.MenuItem,
fyne.NewMenuItemSeparator(),
a.updateWindow.MenuItem,
aboutWindow.MenuItem,
Expand All @@ -101,10 +102,23 @@ func (a *SandboxerApp) Icon() fyne.Resource {
return ApplicationIcon
}

func (s *SandboxerApp) ShowOptions() {
confPath, err := globals.ConfigurationFilePath()
if err != nil {
logging.Errorf("ConfigurationFilePath: %v", err)
return
}
if _, err := os.Stat(confPath); errors.Is(err, os.ErrNotExist) {
logging.Errorf("Configuration is missing: %v", err)
s.optionsWindow.Show()
}
}

func (s *SandboxerApp) Run() {
if len(os.Args) == 2 && os.Args[1] == "--submissions" {
s.submissionsWindow.Show()
}
s.ShowOptions()
go s.CheckUpdate()
s.app.Run()
}
Expand Down Expand Up @@ -167,7 +181,7 @@ func main() {
os.Exit(globals.ExitGetConfigurationFileathError)
}
conf := config.New(configFilePath)
if err := conf.Load(); err != nil {
if err := conf.Load(); err != nil && !errors.Is(err, os.ErrNotExist) {
fmt.Fprintf(os.Stderr, "conf.Load: %v", err)
os.Exit(globals.ExitLoadConfigError)
}
Expand Down
6 changes: 4 additions & 2 deletions cmd/submit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ func main() {
}
conf := config.New(configFilePath)
if err := conf.Load(); err != nil {
fmt.Fprintf(os.Stderr, "conf.Load: %v", err)
os.Exit(20)
if runtime.GOOS == "windows" {
fmt.Fprintf(os.Stderr, "conf.Load: %v", err)
os.Exit(20)
}
}
//close := logging.NewFileLog(conf.LogFolder(), submitLog)
closeLogging, err := globals.SetupLogging(submitLog)
Expand Down
3 changes: 1 addition & 2 deletions pkg/dispatchers/wait_dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ func (*WaitDispatch) InboundChannel() task.Channel {
}

func (d *WaitDispatch) ProcessTask(tsk *task.Task) error {
//tsk.SetState(task.StateCheck)

vOne, err := d.vOne()
if err != nil {
return err
Expand All @@ -45,6 +43,7 @@ func (d *WaitDispatch) ProcessTask(tsk *task.Task) error {
return fmt.Errorf("SandboxSubmissionStatus: %w", err)
}
tsk.Deactivate()
d.list.Updated()
logging.Debugf("%s Status: %v", tsk.SandboxID, status.Status)
switch status.Status {
case vone.StatusSucceeded:
Expand Down

0 comments on commit c5216df

Please sign in to comment.