ui/common/properties.c

changeset 117
b174e721663e
parent 115
e57ca2747782
equal deleted inserted replaced
116:376ef91111f6 117:b174e721663e
99 if(!appname) { 99 if(!appname) {
100 return NULL; 100 return NULL;
101 } 101 }
102 102
103 CxBuffer buf; 103 CxBuffer buf;
104 cxBufferInit(&buf, NULL, 128, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND); 104 cxBufferInit(&buf, cxDefaultAllocator, NULL, 128, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
105 105
106 // add base dir 106 // add base dir
107 char *homeenv = getenv(UI_ENV_HOME); 107 char *homeenv = getenv(UI_ENV_HOME);
108 if(homeenv == NULL) { 108 if(homeenv == NULL) {
109 cxBufferDestroy(&buf); 109 cxBufferDestroy(&buf);
119 #ifdef UI_COCOA 119 #ifdef UI_COCOA
120 // on OS X the app dir is $HOME/Library/Application Support/$APPNAME/ 120 // on OS X the app dir is $HOME/Library/Application Support/$APPNAME/
121 cxBufferPutString(&buf, "Library/Application Support/"); 121 cxBufferPutString(&buf, "Library/Application Support/");
122 #elif defined(_WIN32) 122 #elif defined(_WIN32)
123 // on Windows the app dir is $USERPROFILE/AppData/Local/$APPNAME/ 123 // on Windows the app dir is $USERPROFILE/AppData/Local/$APPNAME/
124 cxBufferPutString(&buf, "AppData\\Local\\"); 124 cxBufferPutString(&buf, "AppData\\Roaming\\");
125 #else 125 #else
126 if(use_xdg_config_home) { 126 if(use_xdg_config_home) {
127 // app dir is $HOME/.config/$APPNAME/ 127 // app dir is $HOME/.config/$APPNAME/
128 char *xdghome = getenv(UI_XDG_CONFIG_HOME_VAR); 128 char *xdghome = getenv(UI_XDG_CONFIG_HOME_VAR);
129 size_t xdghomelen = xdghome ? strlen(xdghome) : 0; 129 size_t xdghomelen = xdghome ? strlen(xdghome) : 0;
334 334
335 335
336 static char* uic_concat_path(const char *base, const char *p, const char *ext) { 336 static char* uic_concat_path(const char *base, const char *p, const char *ext) {
337 size_t baselen = strlen(base); 337 size_t baselen = strlen(base);
338 338
339 CxBuffer *buf = cxBufferCreate(NULL, 32, cxDefaultAllocator, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND); 339 CxBuffer *buf = cxBufferCreate(cxDefaultAllocator, NULL, 32, CX_BUFFER_FREE_CONTENTS|CX_BUFFER_AUTO_EXTEND);
340 if(baselen > 0) { 340 if(baselen > 0) {
341 cxBufferWrite(base, 1, baselen, buf); 341 cxBufferWrite(base, 1, baselen, buf);
342 if(base[baselen - 1] != '/') { 342 if(base[baselen - 1] != '/') {
343 cxBufferPut(buf, '/'); 343 cxBufferPut(buf, '/');
344 } 344 }

mercurial