Skip to content

Instantly share code, notes, and snippets.

@moonburnt
Created July 14, 2020 18:49
Show Gist options
  • Save moonburnt/9e3b54d4290b046e83e9755b8f75cc2c to your computer and use it in GitHub Desktop.
Save moonburnt/9e3b54d4290b046e83e9755b8f75cc2c to your computer and use it in GitHub Desktop.
if __name__ == "__main__":
#this function can be moved everywere, I just didnt want to make another gist
def dirmaker(dir):
try:
os.makedirs(dir)
except FileExistsError:
if os.path.isdir(dir):
pass
else:
error("{} exists but isnt directory. Abort".format(dir)) #probably not the best to handle this, but whatever
sys.exit(1)
except:
raise
sys.exit(1)
if platform.system() == "Linux":
dirmaker(DATA_PATH)
dirmaker(CONFIG_PATH)
dirmaker(TEMP_PATH)
#the rest remains unchanged below
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment