Skip to content

Commit

Permalink
fix: Skip emacs backup files
Browse files Browse the repository at this point in the history
  • Loading branch information
artempyanykh committed Nov 25, 2022
1 parent e7c466f commit 0ad3341
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Marksman/Misc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@ let mkWatchGlob (configuredExts: seq<string>) : string =
$"**/*.{ext_pattern}"

let isMarkdownFile (configuredExts: seq<string>) (path: string) : bool =
// GetExtension returns extension with a '.'. In config we don't have '.'s.
let ext = (Path.GetExtension path).TrimStart('.')
let ext = ext.ToLowerInvariant()
let isEmacsBackup =
try
(Path.GetFileName path).StartsWith(".#")
with :? ArgumentException ->
false

if isEmacsBackup then
false
else
// GetExtension returns extension with a '.'. In config we don't have '.'s.
let ext = (Path.GetExtension path).TrimStart('.')
let ext = ext.ToLowerInvariant()

Seq.contains ext configuredExts
Seq.contains ext configuredExts

type String with

Expand Down

0 comments on commit 0ad3341

Please sign in to comment.