dumpmap: create directories if needed
This commit is contained in:
parent
6e65f8b8bd
commit
9a5cbd5ba7
1 changed files with 4 additions and 0 deletions
|
@ -105,6 +105,10 @@ class MapdataWriter:
|
||||||
def do_write_packages(self):
|
def do_write_packages(self):
|
||||||
for file_path, content in self.write:
|
for file_path, content in self.write:
|
||||||
full_file_path = os.path.join(settings.MAP_ROOT, file_path)
|
full_file_path = os.path.join(settings.MAP_ROOT, file_path)
|
||||||
|
try:
|
||||||
|
os.makedirs(os.path.join(os.path.split(full_file_path)[:-1]))
|
||||||
|
except os.error:
|
||||||
|
pass
|
||||||
if content is not None:
|
if content is not None:
|
||||||
with open(full_file_path, 'w') as f:
|
with open(full_file_path, 'w') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue