mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-05 08:37:20 -04:00
Fix initial entry reader shortcut on Windows
This commit is contained in:
@@ -22,10 +22,12 @@ func main() {
|
|||||||
// initial entry reader shortcut
|
// initial entry reader shortcut
|
||||||
// TODO Do not use file extensions for entries! This will allow doing this check more efficiently than otherwise possible.
|
// 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 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!")
|
fmt.Println("It's a file!")
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("It's a directory!")
|
fmt.Println(offline.AnsiError + "Failed to read \"" + targetLocation + "\" - it is a directory" + offline.AnsiReset)
|
||||||
}
|
}
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ func EntryListGen() {
|
|||||||
dirList = append(dirList, "")
|
dirList = append(dirList, "")
|
||||||
} else {
|
} else {
|
||||||
// otherwise, print the source of the error
|
// 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
|
// quit walking EntryRoot and return nil to allow the program to continue
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ func TargetIsFile(targetLocation string, errorOnFail bool) (bool, bool) {
|
|||||||
targetInfo, err := os.Stat(targetLocation)
|
targetInfo, err := os.Stat(targetLocation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errorOnFail {
|
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)
|
os.Exit(1)
|
||||||
} else {
|
} else {
|
||||||
return false, false
|
return false, false
|
||||||
|
|||||||
Reference in New Issue
Block a user