git://git.jankratochvil.net
/
youtube-dl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef53099
)
Use os.makedirs instead of homebrewn pmkdir
author
Philipp Hagemeister
<phihag@phihag.de>
Tue, 6 Sep 2011 15:32:22 +0000
(17:32 +0200)
committer
Philipp Hagemeister
<phihag@phihag.de>
Tue, 6 Sep 2011 15:32:22 +0000
(17:32 +0200)
youtube-dl
patch
|
blob
|
history
diff --git
a/youtube-dl
b/youtube-dl
index
7ac27b5
..
0b06c69
100755
(executable)
--- a/
youtube-dl
+++ b/
youtube-dl
@@
-456,16
+456,6
@@
class FileDownloader(object):
self.params = params
@staticmethod
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'
def format_bytes(bytes):
if bytes is None:
return 'N/A'
@@
-721,7
+711,7
@@
class FileDownloader(object):
return
try:
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
except (OSError, IOError), err:
self.trouble(u'ERROR: unable to create directories: %s' % str(err))
return