232 |
else |
else |
233 |
*gpx = gpx_parse(dialog, fname); |
*gpx = gpx_parse(dialog, fname); |
234 |
|
|
235 |
free(fname); |
if(!*gpx) { |
236 |
|
/* restoring the gpx file failed, mark it as unusable, but save */ |
237 |
|
/* its presence for later use */ |
238 |
|
|
239 |
|
/* create fake entry to remember this file for next load attempt */ |
240 |
|
*gpx = g_new0(gpx_t, 1); |
241 |
|
(*gpx)->filename = fname; |
242 |
|
(*gpx)->failed = TRUE; |
243 |
|
} else |
244 |
|
free(fname); |
245 |
} |
} |
246 |
} |
} |
247 |
|
|
248 |
/* use next gpx entry of this was loaded successfully */ |
gpx = &((*gpx)->next); |
|
if(*gpx) |
|
|
gpx = &((*gpx)->next); |
|
249 |
} |
} |
250 |
|
|
251 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
337 |
#endif |
#endif |
338 |
appdata->image_path = strdup(DEFAULT_IMAGE_PATH); |
appdata->image_path = strdup(DEFAULT_IMAGE_PATH); |
339 |
|
|
340 |
|
/* check if this path is actually accessible */ |
341 |
|
/* and change it to the current users home if not */ |
342 |
|
/* (this should only happen on scratchbox) */ |
343 |
|
if(!g_file_test(appdata->image_path, G_FILE_TEST_IS_DIR)) { |
344 |
|
if(g_mkdir_with_parents(appdata->image_path, 0700) != 0) { |
345 |
|
char *p = getenv("HOME"); |
346 |
|
if(!p) p = "/tmp/"; |
347 |
|
|
348 |
|
appdata->image_path = |
349 |
|
g_strdup_printf("%s%s%s", p, |
350 |
|
(p[strlen(p)-1]!='/')?"/":"", |
351 |
|
DEFAULT_IMAGE_PATH_HOME); |
352 |
|
printf("using alt path %s\n", appdata->image_path); |
353 |
|
} |
354 |
|
} |
355 |
|
|
356 |
} else { |
} else { |
357 |
/* some versions old versions messed up the path */ |
/* some versions old versions messed up the path */ |
358 |
if(appdata->image_path[strlen(appdata->image_path)-1] != '/') { |
if(appdata->image_path[strlen(appdata->image_path)-1] != '/') { |