Provide feedback after successful server directory initialization

This commit is contained in:
2024-06-05 17:24:45 -04:00
parent 4f9c57d6da
commit 3bac84dc0c
2 changed files with 3 additions and 3 deletions
+3 -2
View File
@@ -52,13 +52,14 @@ func main() {
case "register":
// register a new device ID
// stdin[0] is expected to be the device ID
os.Create(backend.ConfigDir + backend.PathSeparator + "devices" + backend.PathSeparator + stdin[0])
_, _ = os.Create(backend.ConfigDir + backend.PathSeparator + "devices" + backend.PathSeparator + stdin[0]) // error ignored; failure unlikely to occur if init was successful; "register" is not a user-facing argument and thus the error would not be visible
// print EntryRoot and bool indicating OS type to stdout for client to store in config
fmt.Print(backend.EntryRoot + "\x1e" + strconv.FormatBool(backend.IsWindows))
case "init":
// create the necessary directories for libmuttonserver to function
backend.DirInit(false)
os.MkdirAll(backend.ConfigDir+backend.PathSeparator+"deletions", 0700)
_ = os.MkdirAll(backend.ConfigDir+backend.PathSeparator+"deletions", 0700) // error ignored; failure would have occurred by this point in backend.DirInit
fmt.Println("libmuttonserver directories initialized")
case "version", "-v":
versionServer()
default:
-1
View File
@@ -63,7 +63,6 @@ func DirInit(preserveOldConfigDir bool) {
if err != nil {
fmt.Println(AnsiError + "Failed to remove existing config directory: " + err.Error() + AnsiReset)
os.Exit(1)
}
}
}