Skip to content

Commit

Permalink
Add cleanup config (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Jun 9, 2020
1 parent 18bdad6 commit d2bff65
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2020.05-15 (2020/06/09)

* Add `cleanup` config (#23)

## 2020.05-14 (2020/05/29)

* Fix addons startup (portapps/phyrox-portable#3)
Expand Down
7 changes: 5 additions & 2 deletions assets/assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app = waterfox
app.name = Waterfox
app.type = archive
app.version = 2020.05
app.release = 14
app.release = 15
app.homepage = https://www.waterfox.net/

# Portable app
Expand Down
12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type config struct {
Profile string `yaml:"profile" mapstructure:"profile"`
MultipleInstances bool `yaml:"multiple_instances" mapstructure:"multiple_instances"`
DisableTelemetry bool `yaml:"disable_telemetry" mapstructure:"disable_telemetry"`
Cleanup bool `yaml:"cleanup" mapstructure:"cleanup"`
}

var (
Expand All @@ -40,6 +41,7 @@ func init() {
Profile: "default",
MultipleInstances: false,
DisableTelemetry: false,
Cleanup: false,
}

// Init app
Expand Down Expand Up @@ -88,6 +90,16 @@ func main() {
}
}

// Cleanup on exit
if cfg.Cleanup {
defer func() {
utl.Cleanup([]string{
path.Join(os.Getenv("APPDATA"), "Waterfox"),
path.Join(os.Getenv("LOCALAPPDATA"), "Waterfox"),
})
}()
}

// Multiple instances
if cfg.MultipleInstances {
log.Info().Msg("Multiple instances enabled")
Expand Down

0 comments on commit d2bff65

Please sign in to comment.