From 71b5056ca6b32ec912450f849408c88f31467e26 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 1 Jun 2025 14:48:13 -0400 Subject: [PATCH] Do not return isFile, as the returned error can be used for this purpose --- back/files.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/back/files.go b/back/files.go index b4667cf..6454e6e 100644 --- a/back/files.go +++ b/back/files.go @@ -9,22 +9,22 @@ import ( // TargetIsFile checks if the targetLocation is a file, directory, or is inaccessible. // Requires: targetLocation, // failOnDir (whether to return an error if targetLocation is a directory or a file). -// Returns: isFile, isAccessible. -func TargetIsFile(targetLocation string, failOnDir bool) (bool, bool, error) { +// Returns: isAccessible. +func TargetIsFile(targetLocation string, failOnDir bool) (bool, error) { targetInfo, err := os.Stat(targetLocation) if err != nil { - return false, false, errors.New("unable to access \"" + targetLocation + "\": " + err.Error()) + return false, errors.New("unable to access \"" + targetLocation + "\": " + err.Error()) } if targetInfo.IsDir() { if failOnDir { - return false, true, errors.New("\"" + targetLocation + "\" is a directory") + return true, errors.New("\"" + targetLocation + "\" is a directory") } - return false, true, nil + return true, nil } else { if !failOnDir { - return true, true, errors.New("\"" + targetLocation + "\" is a file") + return true, errors.New("\"" + targetLocation + "\" is a file") } - return true, true, nil + return true, nil } }