File tree Expand file tree Collapse file tree 2 files changed +16
-8
lines changed
Expand file tree Collapse file tree 2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 1010 "request" : " launch" ,
1111 "mode" : " auto" ,
1212 "program" : " ${workspaceFolder}" ,
13- "env" : {"SNAP_USER_COMMON" : " mark" },
14- "args" : [" bad-perms .md" ]
13+ // "env": {"SNAP_USER_COMMON": "mark" },
14+ "args" : [" README .md" ]
1515 }
1616 ]
1717}
Original file line number Diff line number Diff line change @@ -4,8 +4,10 @@ import (
44 "crypto/rand"
55 _ "embed"
66 "encoding/hex"
7+ "errors"
78 "flag"
89 "fmt"
10+ "io/fs"
911 "log"
1012 "os"
1113 "path/filepath"
@@ -114,13 +116,18 @@ func getTempDir() string {
114116
115117func check (e error ) {
116118 if e != nil {
117- if os . IsPermission ( e ) {
119+ if errors . Is ( e , fs . ErrPermission ) {
118120 fmt .Println ("There was a permission error accessing the file." )
119- if isSnap () {
120- fmt .Println ("Since mdview was installed as a Snap, it can only access files in your HOME directory." )
121- fmt .Println ("If you need to use it with files outside of your HOME directory, choose a different installation method." )
122- fmt .Println ("https://github.com/mapitman/mdview?tab=readme-ov-file#installation\n " )
123- }
121+ }
122+
123+ if errors .Is (e , fs .ErrNotExist ) {
124+ fmt .Println ("mdview was unable to find the file." )
125+ }
126+
127+ if isSnap () {
128+ fmt .Println ("Since mdview was installed as a Snap, it can only access files in your HOME directory." )
129+ fmt .Println ("If you need to use it with files outside of your HOME directory, choose a different installation method." )
130+ fmt .Println ("https://github.com/mapitman/mdview?tab=readme-ov-file#installation\n " )
124131 }
125132
126133 log .Fatal (e )
@@ -143,6 +150,7 @@ func getTitle(tokens []markdown.Token) string {
143150 }
144151 }
145152 }
153+
146154 return result
147155}
148156
You can’t perform that action at this time.
0 commit comments