From 1c1fcd84860c9892b29ca3741845e64131926c60 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Thu, 13 Mar 2014 20:03:58 +0000
Subject: [PATCH] [Change] Try to create the gen directory before creating
 nebulae in case it fails.

---
 src/nebulae.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/nebulae.c b/src/nebulae.c
index ce1c629..22d6d0a 100644
--- a/src/nebulae.c
+++ b/src/nebulae.c
@@ -488,12 +488,15 @@ static int nebu_generate(void) {
   /* Warn user of what is happening. */
   loadscreen_render(0.05, "Generating Nebulae...");
 
+  /* Get resolution. */
   w = SCREEN_W;
   h = SCREEN_H;
 
+  /* Try to make the directory first if it fails. */
+  lfile_dirMakeExist("%sgen", lfile_basePath());
+
   /* Generate all the nebulae backgrounds. */
   nebu = noise_genNebulaeMap(w, h, NEBULAE_Z, 5.);
-  lfile_dirMakeExist("%sgen", lfile_basePath());
 
   /* Save each nebulae as an image. */
   for(i = 0; i < NEBULAE_Z; i++) {