mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 10:42:34 +01:00
parent
f669b3f046
commit
eef5beb841
@ -184,28 +184,30 @@ class PathFormat():
|
||||
def set_directory(self, kwdict):
|
||||
"""Build directory path and create it if necessary"""
|
||||
self.kwdict = kwdict
|
||||
sep = os.sep
|
||||
|
||||
segments = self.build_directory(kwdict)
|
||||
if segments:
|
||||
self.directory = directory = self.basedirectory + self.clean_path(
|
||||
sep.join(segments) + sep)
|
||||
os.sep.join(segments) + os.sep)
|
||||
else:
|
||||
self.directory = directory = self.basedirectory
|
||||
|
||||
if WINDOWS and self.extended:
|
||||
directory = self._extended_path(directory)
|
||||
self.realdirectory = directory
|
||||
|
||||
def _extended_path(self, path):
|
||||
# Enable longer-than-260-character paths
|
||||
directory = os.path.abspath(directory)
|
||||
if directory.startswith("\\\\"):
|
||||
directory = "\\\\?\\UNC\\" + directory[2:]
|
||||
else:
|
||||
directory = "\\\\?\\" + directory
|
||||
path = os.path.abspath(path)
|
||||
if not path.startswith("\\\\"):
|
||||
path = "\\\\?\\" + path
|
||||
elif not path.startswith("\\\\?\\"):
|
||||
path = "\\\\?\\UNC\\" + path[2:]
|
||||
|
||||
# abspath() in Python 3.7+ removes trailing path separators (#402)
|
||||
if directory[-1] != sep:
|
||||
directory += sep
|
||||
|
||||
self.realdirectory = directory
|
||||
if path[-1] != os.sep:
|
||||
return path + os.sep
|
||||
return path
|
||||
|
||||
def set_filename(self, kwdict):
|
||||
"""Set general filename data"""
|
||||
|
@ -114,6 +114,9 @@ class MetadataPP(PostProcessor):
|
||||
if archive and archive.check(pathfmt.kwdict):
|
||||
return
|
||||
|
||||
if util.WINDOWS and pathfmt.extended:
|
||||
directory = pathfmt._extended_path(self._directory(pathfmt))
|
||||
else:
|
||||
directory = self._directory(pathfmt)
|
||||
path = directory + self._filename(pathfmt)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user