mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(config): prevent overwriting default logPath (#1219)
* fix(config): prevent overwriting logPath default * Fix duplication issue * fix: Preserve non-empty logPath value in config
This commit is contained in:
parent
9ddaea1aa2
commit
89d00d0986
1 changed files with 7 additions and 1 deletions
|
@ -316,7 +316,13 @@ func (c *AppConfig) processLines(lines []string) []string {
|
||||||
}
|
}
|
||||||
if !foundLineLogPath && strings.Contains(line, "logPath =") {
|
if !foundLineLogPath && strings.Contains(line, "logPath =") {
|
||||||
if c.Config.LogPath == "" {
|
if c.Config.LogPath == "" {
|
||||||
lines[i] = `#logPath = ""`
|
// Check if the line already has a value
|
||||||
|
matches := strings.Split(line, "=")
|
||||||
|
if len(matches) > 1 && strings.TrimSpace(matches[1]) != `""` {
|
||||||
|
lines[i] = line // Preserve the existing line
|
||||||
|
} else {
|
||||||
|
lines[i] = `#logPath = ""`
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
lines[i] = fmt.Sprintf("logPath = \"%s\"", c.Config.LogPath)
|
lines[i] = fmt.Sprintf("logPath = \"%s\"", c.Config.LogPath)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue