mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 14:03:28 -04:00
Horribly untested improvement for #555 which I will test momentarily.
This commit is contained in:
parent
f0aa5e1d5e
commit
dea1c7607a
1 changed files with 13 additions and 6 deletions
|
@ -20,23 +20,30 @@ class DirectoryController(object):
|
|||
def bin_directory(self):
|
||||
return self.root_install_directory
|
||||
|
||||
def mkdir(self, path):
|
||||
if os.path.exists(path):
|
||||
print(u"Skipping creation of " + path + " because it exists.")
|
||||
else:
|
||||
os.mkdir(path)
|
||||
|
||||
def create_directory_in_tmp(self,subdirectory):
|
||||
os.mkdir(self.generate_path_for_directory_in_tmp(subdirectory))
|
||||
path = self.generate_path_for_directory_in_tmp(subdirectory)
|
||||
self.mkdir(path)
|
||||
|
||||
def generate_path_for_directory_in_tmp(self,subdirectory):
|
||||
return self.tmp_directory + os.sep + subdirectory
|
||||
def create_directory_in_bin(self,subdirectory):
|
||||
full_path = self.bin_directory + os.sep + subdirectory
|
||||
os.mkdir(full_path)
|
||||
self.mkdir(full_path)
|
||||
|
||||
def create_base_directories(self):
|
||||
shutil.rmtree(self.root_dir + os.sep + "coco" + os.sep + "node_modules",ignore_errors=True) #just in case
|
||||
try:
|
||||
if os.path.exists(self.tmp_directory):
|
||||
self.remove_tmp_directory()
|
||||
os.mkdir(self.tmp_directory)
|
||||
if os.path.exists(self.tmp_directory):
|
||||
self.remove_tmp_directory()
|
||||
os.mkdir(self.tmp_directory)
|
||||
except:
|
||||
raise errors.CoCoError(u"There was an error creating the directory structure, do you have correct permissions? Please remove all and start over.")
|
||||
raise errors.CoCoError(u"There was an error creating the directory structure, do you have correct permissions? Please remove all and start over.")
|
||||
|
||||
def remove_directories(self):
|
||||
shutil.rmtree(self.bin_directory + os.sep + "node",ignore_errors=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue