Skip to content

Cleanup directories handling #765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed now useless local variable
  • Loading branch information
cmaglie committed Feb 10, 2023
commit 1386a7bbbf1a2c7c0c44660820e3408b396cdaa2
10 changes: 3 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,6 @@ func loop() {
log.SetLevel(log.InfoLevel)
log.SetOutput(os.Stdout)

// the important folders of the agent
src, _ := os.Executable()
srcPath := paths.New(src) // The path of the agent's binary
srcDir := srcPath.Parent() // The directory of the agent's binary

// Instantiate Tools
Tools = tools.Tools{
Directory: getDataDir().String(),
Expand Down Expand Up @@ -221,8 +216,9 @@ func loop() {
configPath = defaultConfigPath
log.Infof("using config from default: %s", configPath)
} else {
// take the config from the old folder where the agent's binary sits
oldConfigPath := srcDir.Join("config.ini")
// Fall back to the old config.ini location
src, _ := os.Executable()
oldConfigPath := paths.New(src).Parent().Join("config.ini")
if oldConfigPath.Exist() {
err := oldConfigPath.CopyTo(defaultConfigPath)
if err != nil {
Expand Down