From 54c2399a7c3c4138674e805e34217a6def116184 Mon Sep 17 00:00:00 2001
From: tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>
Date: Wed, 25 Aug 2010 03:24:18 +0000
Subject: MCOP first run now creates required directory instead of throwing
 error message Patch kindly provided by Darrell Anderson

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/arts@1167610 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
---
 mcop/mcoputils.cc | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/mcop/mcoputils.cc b/mcop/mcoputils.cc
index 2fc90f0..3922824 100644
--- a/mcop/mcoputils.cc
+++ b/mcop/mcoputils.cc
@@ -47,9 +47,16 @@ static int check_tmp_dir(const char *tmp_dir)
   int result;
   struct stat stat_buf;
   result = lstat(tmp_dir, &stat_buf);
-  if ((result == -1) && (errno == ENOENT))
+  
+if ((result == -1) && (errno == ENOENT))
   {
-    return 1;
+    result = mkdir(tmp_dir, 0700);
+    if (result == -1)
+    {
+       arts_warning("Error: Cannot create directory \"%s\".\n", tmp_dir);
+       return 1;
+    }
+    result = stat(tmp_dir, &stat_buf);
   }
   if ((result == -1) || (!S_ISDIR(stat_buf.st_mode)))
   {
-- 
cgit v1.2.3

