Index: trunk/psModules/src/config/pmConfig.c
===================================================================
--- trunk/psModules/src/config/pmConfig.c	(revision 18061)
+++ trunk/psModules/src/config/pmConfig.c	(revision 18073)
@@ -42,4 +42,6 @@
 static bool readCameraConfig = true;    // Read the camera config on startup (with pmConfigRead)?
 static psArray *configPath = NULL;      // Search path for configuration files
+
+static bool checkPath(const char *filename, bool create, bool trunc);
 
 bool pmConfigReadParamsSet(bool newReadCameraConfig)
@@ -1490,5 +1492,5 @@
 
 // convert the supplied name, create a new output psString
-psString pmConfigConvertFilename(const char *filename, const pmConfig *config, bool create, bool truncate)
+psString pmConfigConvertFilename(const char *filename, const pmConfig *config, bool create, bool trunc)
 {
     PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
@@ -1507,7 +1509,7 @@
         newName = tmpName;
 
-        if (!create && access(newName, R_OK) != 0) {
-            psError(PS_ERR_IO, true, "Unable to access file %s", newName);
-            psFree(newName);
+        if (!checkPath(newName, create, trunc)) {
+            // let checkPath()'s psError() call float up
+            psFree (newName);
             return NULL;
         }
@@ -1556,9 +1558,10 @@
         newName = tmpName;
 
-        if (!create && access(newName, R_OK) != 0) {
-            psError(PS_ERR_IO, true, "Unable to access file %s", newName);
-            psFree(newName);
+        if (!checkPath(newName, create, trunc)) {
+            // let checkPath()'s psError() call float up
+            psFree (newName);
             return NULL;
         }
+
         return newName;
     }
@@ -1596,15 +1599,17 @@
 
         char *nebfile = NULL;
-        if (create) {
-            nebfile = nebCreate(server, filename, NULL, NULL);
-            if (!nebfile) {
-                psError(PM_ERR_SYS, true, "failed to create a new nebulous key: %s", nebErr(server));
-                nebServerFree(server);
-                return NULL;
-            }
-        } else {
-            nebfile = nebFind(server, filename);
-            if (!nebfile) {
-                psError(PM_ERR_SYS, true, "failed to find nebulous key: %s", nebErr(server));
+        if (!(nebfile = nebFind(server, filename))) {
+            // object does not exist
+            if (create) {
+                nebfile = nebCreate(server, filename, NULL, NULL);
+                if (!nebfile) {
+                    psError(PM_ERR_SYS, true, "failed to create a new nebulous key: %s", nebErr(server));
+                    nebServerFree(server);
+                    return NULL;
+                }
+            } else {
+                // if the object does not exist and create isn't set, then we
+                // should puke
+                psError(PM_ERR_SYS, true, "Unable to access file %s", filename);
                 nebServerFree(server);
                 return NULL;
@@ -1616,4 +1621,12 @@
         nebFree(nebfile);
         nebServerFree(server);
+
+        if (trunc) {
+            if(truncate(filename, 0) != 0) {
+                psError(PS_ERR_IO, true, "Failed to truncate file, %s\n", filename);
+                nebServerFree(server);
+                return NULL;
+            }
+        }
 
         return path;
@@ -1694,4 +1707,39 @@
 }
 
+static bool checkPath(const char *filename, bool create, bool trunc)
+{
+    PS_ASSERT_PTR_NON_NULL(filename, false);
+
+    if (access(filename, R_OK) == 0) {
+        // file already exists
+        if (trunc) {
+            if(truncate(filename, 0) != 0) {
+                psError(PS_ERR_IO, true, "Failed to truncate file, %s\n", filename);
+                return false;
+            }
+        }
+    } else {
+        // file does not exist
+        if (create) {
+            int fd = open(filename, O_WRONLY|O_CREAT, 0666);
+            if (fd == 0) {
+                psError(PS_ERR_IO, true, "Failed to close file, %s\n", filename);
+                return false;
+            }
+            if (close(fd) != 0) {
+                psError(PS_ERR_IO, true, "Failed to close file, %s\n", filename);
+                return false;
+            }
+        } else {
+            // if the file does not exist and create isn't set, then we
+            // should puke
+            psError(PS_ERR_IO, true, "Unable to access file %s", filename);
+            return false;
+        }
+    }
+
+    return true;
+}
+
 
 #if 0
