mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-27 20:36:29 -04:00
Fix initial entry reader shortcut on Windows
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user