mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-23 15:18:24 +00:00
Correctly set default logfile location on Windows (fixes #2608)
This commit is contained in:
parent
71d98c2f26
commit
fb82a5e086
@ -222,7 +222,6 @@ func defaultRuntimeOptions() RuntimeOptions {
|
|||||||
assetDir: os.Getenv("STGUIASSETS"),
|
assetDir: os.Getenv("STGUIASSETS"),
|
||||||
cpuProfile: os.Getenv("STCPUPROFILE") != "",
|
cpuProfile: os.Getenv("STCPUPROFILE") != "",
|
||||||
stRestarting: os.Getenv("STRESTART") != "",
|
stRestarting: os.Getenv("STRESTART") != "",
|
||||||
logFile: "-", // Output to stdout
|
|
||||||
logFlags: log.Ltime,
|
logFlags: log.Ltime,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,8 +233,12 @@ func defaultRuntimeOptions() RuntimeOptions {
|
|||||||
options.logFlags = log.Ltime | log.Ldate | log.Lmicroseconds | log.Lshortfile
|
options.logFlags = log.Ltime | log.Ldate | log.Lmicroseconds | log.Lshortfile
|
||||||
}
|
}
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
options.logFile = locations[locLogFile]
|
// On non-Windows, we explicitly default to "-" which means stdout. On
|
||||||
|
// Windows, the blank options.logFile will later be replaced with the
|
||||||
|
// default path, unless the user has manually specified "-" or
|
||||||
|
// something else.
|
||||||
|
options.logFile = "-"
|
||||||
}
|
}
|
||||||
|
|
||||||
return options
|
return options
|
||||||
@ -299,6 +302,12 @@ func main() {
|
|||||||
l.Fatalln(err)
|
l.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if options.logFile == "" {
|
||||||
|
// Blank means use the default logfile location. We must set this
|
||||||
|
// *after* expandLocations above.
|
||||||
|
options.logFile = locations[locLogFile]
|
||||||
|
}
|
||||||
|
|
||||||
if options.showVersion {
|
if options.showVersion {
|
||||||
fmt.Println(LongVersion)
|
fmt.Println(LongVersion)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user