summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup/FilenameMapping.py
diff options
context:
space:
mode:
authorowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2008-11-13 00:15:56 +0000
committerowsla <owsla@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2008-11-13 00:15:56 +0000
commit9eba7fcf2868607443f267f4c8fe7cbe576c3bdb (patch)
treef7f5a67274400cc1517b1b3fa07f4d8506888885 /rdiff-backup/rdiff_backup/FilenameMapping.py
parent63f29f5aa1d8fe0465a997bcdc628c055c02695b (diff)
downloadrdiff-backup-9eba7fcf2868607443f267f4c8fe7cbe576c3bdb.tar.gz
Escape trailing spaces and periods on systems which require it
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@961 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup/FilenameMapping.py')
-rw-r--r--rdiff-backup/rdiff_backup/FilenameMapping.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/rdiff-backup/rdiff_backup/FilenameMapping.py b/rdiff-backup/rdiff_backup/FilenameMapping.py
index 5fbd9dd..439836e 100644
--- a/rdiff-backup/rdiff_backup/FilenameMapping.py
+++ b/rdiff-backup/rdiff_backup/FilenameMapping.py
@@ -85,6 +85,19 @@ def quote(path):
"""
QuotedPath = chars_to_quote_regexp.sub(quote_single, path)
+ if not Globals.must_escape_dos_devices \
+ and not Globals.must_escape_trailing_spaces:
+ return QuotedPath
+
+ if Globals.must_escape_dos_devices:
+ assert Globals.must_escape_trailing_spaces
+
+ # Escape a trailing space or period (invalid in names on FAT32 under DOS,
+ # Windows and modern Linux)
+ if len(QuotedPath) and (QuotedPath[-1] == ' ' or QuotedPath[-1] == '.'):
+ QuotedPath = QuotedPath[:-1] + \
+ "%s%03d" % (quoting_char, ord(QuotedPath[-1]))
+
if not Globals.must_escape_dos_devices:
return QuotedPath