Hello,

In the past, I have submitted a patch, which was then sort of
considered adding, but never made it into CVS.

The patch to Application.C uses a $HOME/.dx/ subdirectory for all
the DX app. files, instead of putting these files directly in $HOME.
Patch is below.

Regards,
Rob.

Index: src/uipp/base/Application.C
===================================================================
RCS file: /src/master/dx/src/uipp/base/Application.C,v
retrieving revision 1.16
diff -u -r1.16 Application.C
--- src/uipp/base/Application.C 30 Sep 2003 17:41:46 -0000      1.16
+++ src/uipp/base/Application.C 3 Nov 2003 10:29:56 -0000
@@ -18,6 +18,7 @@
 #include <errno.h> // for errno
 #include <fcntl.h> // for stat
 #include <ctype.h> // for tolower
+#include <libgen.h> // for dirname

 #if defined(HAVE_UNISTD_H)
 #include <unistd.h>
@@ -543,10 +544,9 @@
 {
     const char* class_name = this->getApplicationClass();
     char* home = (char*)getenv("HOME");
-    int len = strlen(home);
     strcpy (res_file, home);
-    res_file[len++] = '/';
-    res_file[len++] = '.';
+    strcat (res_file, "/.dx/");
+    int len = strlen(res_file);
     char* cp = (char*)class_name;
     while (*cp) {
        res_file[len++] = tolower(*cp);
@@ -561,12 +561,14 @@
 #if !defined(DXD_OS_NON_UNIX)
     int ru = S_IRUSR;
     int wu = S_IWUSR;
+    int xu = S_IXUSR;
     int rg = S_IRGRP;
     int ro = S_IROTH;
     int reg = S_IFREG;
 #else
     int ru = _S_IREAD;
     int wu = _S_IWRITE;
+    int xu = 0;
     int rg = 0;
     int ro = 0;
     int reg = _S_IFREG;
@@ -594,6 +596,8 @@
            writable = FALSE;
        }
     } else if ((errno==ENOENT)&&(create)) {
+       // New directory also needs execution bit for user
+       mkdir(dirname(res_file), ru | wu | xu | rg | ro);
        int fd = creat(res_file, ru | wu | rg | ro); 
//S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
        if (fd >= 0) {
            close(fd);



Reply via email to