From 50891fece71b05bce92f694451656988b53a7038 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Tue, 6 Sep 2011 17:32:22 +0200 Subject: [PATCH] Use os.makedirs instead of homebrewn pmkdir --- youtube-dl | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/youtube-dl b/youtube-dl index 7ac27b5a04..0b06c69cc5 100755 --- a/youtube-dl +++ b/youtube-dl @@ -455,16 +455,6 @@ class FileDownloader(object): self._screen_file = [sys.stdout, sys.stderr][params.get('logtostderr', False)] self.params = params - @staticmethod - def pmkdir(filename): - """Create directory components in filename. Similar to Unix "mkdir -p".""" - components = filename.split(os.sep) - aggregate = [os.sep.join(components[0:x]) for x in xrange(1, len(components))] - aggregate = ['%s%s' % (x, os.sep) for x in aggregate] # Finish names with separator - for dir in aggregate: - if not os.path.exists(dir): - os.mkdir(dir) - @staticmethod def format_bytes(bytes): if bytes is None: @@ -721,7 +711,7 @@ class FileDownloader(object): return try: - self.pmkdir(filename) + os.makedirs(os.path.dirname(filename)) except (OSError, IOError), err: self.trouble(u'ERROR: unable to create directories: %s' % str(err)) return