ox.makedirs
This commit is contained in:
parent
515d769f9f
commit
9a05621d69
2 changed files with 9 additions and 2 deletions
10
ox/file.py
10
ox/file.py
|
@ -11,7 +11,7 @@ import subprocess
|
|||
|
||||
from ox.utils import json
|
||||
|
||||
__all__ = ['sha1sum', 'oshash', 'avinfo']
|
||||
__all__ = ['sha1sum', 'oshash', 'avinfo', 'makedirs']
|
||||
|
||||
def sha1sum(filename):
|
||||
sha1 = hashlib.sha1()
|
||||
|
@ -80,3 +80,11 @@ def avinfo(filename):
|
|||
return info
|
||||
|
||||
return {'path': filename, 'size': 0}
|
||||
|
||||
def makedirs(path):
|
||||
if not os.path.exists(path):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError, e:
|
||||
if e.errno != 17:
|
||||
raise
|
||||
|
|
|
@ -13,4 +13,3 @@ except ImportError:
|
|||
except ImportError:
|
||||
from django.utils import simplejson as json
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue