330 |
#endif |
#endif |
331 |
appdata->image_path = strdup(DEFAULT_IMAGE_PATH); |
appdata->image_path = strdup(DEFAULT_IMAGE_PATH); |
332 |
|
|
333 |
|
/* check if this path is actually accessible */ |
334 |
|
/* and change it to the current users home if not */ |
335 |
|
/* (this should only happen on scratchbox) */ |
336 |
|
if(!g_file_test(appdata->image_path, G_FILE_TEST_IS_DIR)) { |
337 |
|
if(g_mkdir_with_parents(appdata->image_path, 0700) != 0) { |
338 |
|
char *p = getenv("HOME"); |
339 |
|
if(!p) p = "/tmp/"; |
340 |
|
|
341 |
|
appdata->image_path = |
342 |
|
g_strdup_printf("%s%s%s", p, |
343 |
|
(p[strlen(p)-1]!='/')?"/":"", |
344 |
|
DEFAULT_IMAGE_PATH_HOME); |
345 |
|
printf("using alt path %s\n", appdata->image_path); |
346 |
|
} |
347 |
|
} |
348 |
|
|
349 |
} else { |
} else { |
350 |
/* some versions old versions messed up the path */ |
/* some versions old versions messed up the path */ |
351 |
if(appdata->image_path[strlen(appdata->image_path)-1] != '/') { |
if(appdata->image_path[strlen(appdata->image_path)-1] != '/') { |