diff --git a/main.go b/main.go index 3a6006a..1a7cc6f 100644 --- a/main.go +++ b/main.go @@ -22,10 +22,12 @@ func main() { // initial entry reader shortcut // TODO Do not use file extensions for entries! This will allow doing this check more efficiently than otherwise possible. if strings.HasPrefix(args[0], "/") { - if isFile, _ := offline.TargetIsFile(offline.EntryRoot+args[0], true); isFile { + targetLocation := offline.EntryRoot + offline.PathSeparator + args[0][1:] + if isFile, _ := offline.TargetIsFile(targetLocation, true); isFile { + // TODO decrypt and display the entry fmt.Println("It's a file!") } else { - fmt.Println("It's a directory!") + fmt.Println(offline.AnsiError + "Failed to read \"" + targetLocation + "\" - it is a directory" + offline.AnsiReset) } os.Exit(0) } diff --git a/src/cli/entryList.go b/src/cli/entryList.go index 8ed0f63..e7d04d5 100644 --- a/src/cli/entryList.go +++ b/src/cli/entryList.go @@ -95,7 +95,7 @@ func EntryListGen() { dirList = append(dirList, "") } else { // otherwise, print the source of the error - fmt.Print("\n\n" + offline.AnsiError + "An unexpected error occurred while generating the entry list: " + err.Error() + offline.AnsiReset) + fmt.Println(offline.AnsiError + "An unexpected error occurred while generating the entry list: " + err.Error() + offline.AnsiReset) } // quit walking EntryRoot and return nil to allow the program to continue return nil diff --git a/src/offline/targetChecks.go b/src/offline/targetChecks.go index 6671176..9590a5c 100644 --- a/src/offline/targetChecks.go +++ b/src/offline/targetChecks.go @@ -11,7 +11,7 @@ func TargetIsFile(targetLocation string, errorOnFail bool) (bool, bool) { targetInfo, err := os.Stat(targetLocation) if err != nil { if errorOnFail { - fmt.Println(AnsiError + "Failed to access " + targetLocation + " - ensure it exists and has the correct permissions" + AnsiReset) + fmt.Println(AnsiError + "Failed to access \"" + targetLocation + "\" - ensure it exists and has the correct permissions" + AnsiReset) os.Exit(1) } else { return false, false