Skip to content

Commit c1d91c9

Browse files
author
Jonathan Kamens
committed
Allow paths to be specified to undelete
Fixes https://debathena.mit.edu/trac/ticket/1577.
1 parent 458003a commit c1d91c9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

libdelete.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,14 @@ def find_deleted_files(file_or_pattern, follow_links=False,
187187
# The old code called readdir() and lstat'd everything before following.
188188
# The old code also re-implemented glob() with BREs, and we're not doing
189189
# that.
190-
file_list = glob.glob(file_or_pattern) + glob.glob('.#' + file_or_pattern)
190+
file_list = glob.glob(file_or_pattern)
191+
if os.path.dirname(file_or_pattern) == '':
192+
file_list += glob.glob('.#' + file_or_pattern)
193+
else:
194+
file_list += glob.glob(os.path.join(
195+
os.path.dirname(file_or_pattern), '.#' +
196+
os.path.basename(file_or_pattern)))
197+
191198
if len(file_list) == 0:
192199
raise DeleteError("{0}: {1}".format(
193200
file_or_pattern,

0 commit comments

Comments
 (0)