mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 13:00:52 +08:00
fix: Return an error if the user home directory cannot be determined for the fallback log path.
This commit is contained in:
@@ -99,9 +99,11 @@ func ConfigureLogOutput(loggingToFile bool, logsMaxTotalSizeMB int) error {
|
||||
// When logging to file is enabled but WRITABLE_PATH is not set,
|
||||
// use a default writable location to avoid errors on read-only filesystems
|
||||
// (e.g., Homebrew installations on macOS).
|
||||
if home, err := os.UserHomeDir(); err == nil {
|
||||
logDir = filepath.Join(home, ".cliproxyapi", "logs")
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return fmt.Errorf("logging: failed to determine user home directory for fallback log path: %w", err)
|
||||
}
|
||||
logDir = filepath.Join(home, ".cliproxyapi", "logs")
|
||||
}
|
||||
|
||||
protectedPath := ""
|
||||
|
||||
Reference in New Issue
Block a user