summaryrefslogtreecommitdiff
path: root/app/wlib/gtklib/wpref.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/wlib/gtklib/wpref.c')
-rw-r--r--app/wlib/gtklib/wpref.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/app/wlib/gtklib/wpref.c b/app/wlib/gtklib/wpref.c
index 356dd95..d83f3e9 100644
--- a/app/wlib/gtklib/wpref.c
+++ b/app/wlib/gtklib/wpref.c
@@ -107,6 +107,11 @@ const char * wGetAppLibDir( void )
return appLibDir;
}
+ strcpy(appLibDir, XTRKCAD_INSTALL_PREFIX "/" XTRKCAD_SHARE_INSTALL_DIR);
+ if ((stat( appLibDir, &buf) == 0 ) && S_ISDIR(buf.st_mode)) {
+ return appLibDir;
+ }
+
char * dir1 = "/usr/share/";
char * dir2 = "/usr/local/share/";
char * beta = "";
@@ -265,13 +270,15 @@ wlibSetProfileFilename(char *name)
if (name && name[0]) {
size_t length;
length = snprintf(profileFile, 0, "%s", name);
- profileFile = malloc(length + sizeof(NULL));
+ length += sizeof("");
+ profileFile = malloc(length);
snprintf( profileFile, length, "%s", name );
} else {
size_t length;
length = snprintf(profileFile, 0, "%s/%s.rc", workDir, wConfigName );
- profileFile = malloc(length + sizeof(NULL));
- length = snprintf(profileFile, length+sizeof(NULL), "%s/%s.rc", workDir, wConfigName );
+ length += sizeof("");
+ profileFile = malloc(length);
+ length = snprintf(profileFile, length, "%s/%s.rc", workDir, wConfigName );
}
}
@@ -631,4 +638,4 @@ wPrefFormatLine(const char* section, const char* name, const char* value, char*
value = "";
}
sprintf(result, "%s.%s: %s", section, name, value);
-} \ No newline at end of file
+}