about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2011-09-06 17:32:22 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2011-09-06 17:32:22 +0200
commit50891fece71b05bce92f694451656988b53a7038 (patch)
tree035a42ab22a9df620fcd40fe790942c9478543df
parentef53099e35180f0453f40c9a440a04116ed8c370 (diff)
downloadyoutube-dl-50891fece71b05bce92f694451656988b53a7038.tar.gz
youtube-dl-50891fece71b05bce92f694451656988b53a7038.tar.xz
youtube-dl-50891fece71b05bce92f694451656988b53a7038.zip
Use os.makedirs instead of homebrewn pmkdir
-rwxr-xr-xyoutube-dl12
1 files changed, 1 insertions, 11 deletions
diff --git a/youtube-dl b/youtube-dl
index 7ac27b5a0..0b06c69cc 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -456,16 +456,6 @@ class FileDownloader(object):
 		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:
 			return 'N/A'
@@ -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