summaryrefslogtreecommitdiff
path: root/rapid/renamesubfolderprefs.py
diff options
context:
space:
mode:
Diffstat (limited to 'rapid/renamesubfolderprefs.py')
-rw-r--r--rapid/renamesubfolderprefs.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/rapid/renamesubfolderprefs.py b/rapid/renamesubfolderprefs.py
index 845f809..d46a8c1 100644
--- a/rapid/renamesubfolderprefs.py
+++ b/rapid/renamesubfolderprefs.py
@@ -64,7 +64,6 @@ _ = Configi18n._
import datetime
-import ValidatedEntry
import config
from common import pythonifyVersion
@@ -1456,6 +1455,8 @@ class SubfolderPreferences(ImageRenamePreferences):
self.component = pn.SUBFOLDER_COMPONENT
ImageRenamePreferences.__init__(self, prefList, parent)
+ self.stripExtraneousWhiteSpace = re.compile(r'\s*%s\s*' % os.sep)
+
def generateNameUsingPreferences(self, photo, existingFilename=None,
stripCharacters = False, fallback_date = None):
"""
@@ -1477,6 +1478,10 @@ class SubfolderPreferences(ImageRenamePreferences):
if subfolders:
if subfolders[0] == os.sep:
subfolders = subfolders[1:]
+
+ # remove any spaces before and after a directory name
+ if subfolders and stripCharacters:
+ subfolders = self.stripExtraneousWhiteSpace.sub(os.sep, subfolders)
return subfolders