const char * xdgCacheHome(xdgHandle *handle) { if (handle) return xdgGetCache(handle)->cacheHome; else return xdgGetRelativeHome("XDG_CACHE_HOME", DefaultRelativeCacheHome, sizeof(DefaultRelativeCacheHome)-1); }
const char * xdgDataHome(xdgHandle *handle) { if (handle) return xdgGetCache(handle)->dataHome; else return xdgGetRelativeHome("XDG_DATA_HOME", DefaultRelativeDataHome, sizeof(DefaultRelativeDataHome)-1); }
const char * xdgConfigHome(xdgHandle *handle) { if (handle) return xdgGetCache(handle)->configHome; else return xdgGetRelativeHome("XDG_CONFIG_HOME", DefaultRelativeConfigHome, sizeof(DefaultRelativeConfigHome)-1); }
int xdgUpdateData(xdgHandle *handle) { xdgCachedData* cache = (xdgCachedData*)malloc(sizeof(xdgCachedData)); xdgCachedData* oldCache; if (!cache) return FALSE; xdgZeroMemory(cache, sizeof(xdgCachedData)); if (xdgUpdateHomeDirectories(cache) && xdgUpdateDirectoryLists(cache)) { /* Update successful, replace pointer to old cache with pointer to new cache */ oldCache = xdgGetCache(handle); handle->reserved = cache; if (oldCache) { xdgFreeData(oldCache); free(oldCache); } return TRUE; } else { /* Update failed, discard new cache and leave old cache unmodified */ xdgFreeData(cache); free(cache); return FALSE; } }
const char * xdgRuntimeDirectory(xdgHandle *handle) { if (handle) return xdgGetCache(handle)->runtimeDirectory; else return xdgEnvDup("XDG_RUNTIME_DIRECTORY"); }
void xdgWipeHandle(xdgHandle *handle) { xdgCachedData* cache = xdgGetCache(handle); xdgFreeData(cache); free(cache); }
const char * xdgCacheHome(xdgHandle *handle) { return xdgGetCache(handle)->cacheHome; }
const char * xdgDataHome(xdgHandle *handle) { return xdgGetCache(handle)->dataHome; }