Skip to content

Commit

Permalink
support for dir exclusions starting with .\ and \
Browse files Browse the repository at this point in the history
if the directory exclusion starts with ".\" it will be considered to be located in the root directory, if starts with "\" it will match every directory that starts with
  • Loading branch information
1024mb committed Jul 29, 2022
1 parent e02ce96 commit acac78a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions save-file-attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ def collect_file_attrs(path, exclusions, origpath, relative, exclusionsfile, exc
exclusionsdir[i] = re.escape(s)
else:
for i, s in enumerate(exclusionsdir):
r = os.path.relpath(s)
exclusionsdir[i] = re.escape(r)
if re.search("(^\\.\\\\|^\\\\)", s) is not None:
exclusionsdir[i] = re.escape(s)
else:
r = os.path.relpath(s)
exclusionsdir[i] = re.escape(r)
regex_excl_dirs = "|".join(exclusionsdir)
else: # if relative is true
if exclusions is not None:
Expand All @@ -93,8 +96,11 @@ def collect_file_attrs(path, exclusions, origpath, relative, exclusionsfile, exc
regex_excl = "|".join(exclusionsfile)
if exclusionsdir is not None:
for i, s in enumerate(exclusionsdir):
r = os.path.relpath(s)
exclusionsdir[i] = re.escape(r)
if re.search("(^\\.\\\\|^\\\\)", s) is not None:
exclusionsdir[i] = re.escape(s)
else:
r = os.path.relpath(s)
exclusionsdir[i] = re.escape(r)
regex_excl_dirs = "|".join(exclusionsdir)
# exclusions setup end

Expand Down

0 comments on commit acac78a

Please sign in to comment.