[ros-diffs] [cwittich] 31637: create obj and output dir when they don't exist

cwittich at svn.reactos.org cwittich at svn.reactos.org
Mon Jan 7 10:24:53 CET 2008


Author: cwittich
Date: Mon Jan  7 12:24:52 2008
New Revision: 31637

URL: http://svn.reactos.org/svn/reactos?rev=31637&view=rev
Log:
create obj and output dir when they don't exist

Modified:
    trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c

Modified: trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c
URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c?rev=31637&r1=31636&r2=31637&view=diff
==============================================================================
--- trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c (original)
+++ trunk/tools/RosBE/RosBE-Windows/Tools/config/options.c Mon Jan  7 12:24:52 2008
@@ -11,6 +11,22 @@
 #include "options.h"
 
 HINSTANCE hInstance;
+
+BOOL CreateDir(HWND hwnd, WCHAR* dir)
+{
+    WCHAR msgerror[256];
+
+    if (0 > (LONG)GetFileAttributes(dir))
+    {
+        if (CreateDirectory(dir, NULL) == 0)
+        {
+            LoadString(hInstance, MSG_DIREFAILED, msgerror, 256);
+            MessageBox(hwnd, msgerror, NULL, MB_ICONERROR);
+            return FALSE;
+        }
+    }
+    return TRUE;
+}
 
 INT
 WriteSettings(HWND hwnd)
@@ -36,13 +52,16 @@
     GetDlgItemTextW(hwnd, ID_OUTDIR, outdir, MAX_PATH);
 
     if (writelog && (logdir[0] != 0))
-        if (0 > (LONG)GetFileAttributes(logdir))
-            if (CreateDirectory(logdir, NULL) == 0)
-            {
-                LoadString(hInstance, MSG_DIREFAILED, msgerror, 256);
-                MessageBox(hwnd, msgerror, NULL, MB_ICONERROR);
-                return FALSE;
-            }
+        if (!CreateDir(hwnd, logdir))
+            return FALSE;
+
+    if (objstate && (objdir[0] != 0))
+        if (!CreateDir(hwnd, objdir))
+            return FALSE;
+
+    if (outstate && (outdir[0] != 0))
+        if (!CreateDir(hwnd, outdir))
+            return FALSE;
 
     wcscpy(checkmgw, mingwpath);
     if ((wcslen(checkmgw) + wcslen(L"\\bin\\gcc.exe")) < MAX_PATH)




More information about the Ros-diffs mailing list