# -*- coding: utf8 -*-

"""
Module to work with world maps (Generation, edition, save...)
"""
import subprocess

import config

class map:
	@staticmethod
	def generate(name, width, height):
		command = config.generator['map']['generator'] % (
			config.generator['map']['destination-dir'] + '/' + name,
			width,
			height
		)
		subprocess.call(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

@@ -105,16 +105,25 @@
 process%0A
+import os
 %0Aimport 
@@ -130,16 +130,17 @@
 config%0A%0A
+%0A
 class ma
@@ -330,16 +330,144 @@
 ght%0A%09%09)%0A
+%09%09if not os.path.exists(config.generator%5B'map'%5D%5B'destination-dir'%5D):%0A%09%09%09os.makedirs(config.generator%5B'map'%5D%5B'destination-dir'%5D)%0A
 %09%09subpro

create destination folder if it does not exist