diff options
| author | 2020-03-28 23:01:51 -0400 | |
|---|---|---|
| committer | 2020-03-28 23:01:51 -0400 | |
| commit | e4887ae6b00c50fbbde531cc274c77b076bd821d (patch) | |
| tree | 051849d0ce8ed35aa229ba828a2dfe1faf10c5c0 /gallery_dl/util.py | |
| parent | e8cc000750de972384f2f34d02d42222b4018ae9 (diff) | |
New upstream version 1.13.3upstream/1.13.3
Diffstat (limited to 'gallery_dl/util.py')
| -rw-r--r-- | gallery_dl/util.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gallery_dl/util.py b/gallery_dl/util.py index 232047c..47fad9e 100644 --- a/gallery_dl/util.py +++ b/gallery_dl/util.py @@ -726,6 +726,7 @@ class PathFormat(): def set_directory(self, kwdict): """Build directory path and create it if necessary""" + windows = os.name == "nt" # Build path segments by applying 'kwdict' to directory format strings segments = [] @@ -733,6 +734,9 @@ class PathFormat(): try: for formatter in self.directory_formatters: segment = formatter(kwdict).strip() + if windows: + # remove trailing dots and spaces (#647) + segment = segment.rstrip(". ") if segment: append(self.clean_segment(segment)) except Exception as exc: @@ -747,7 +751,7 @@ class PathFormat(): directory += sep self.directory = directory - if os.name == "nt": + if windows: # Enable longer-than-260-character paths on Windows directory = "\\\\?\\" + os.path.abspath(directory) |
