[Freeassociation-devel] Suggestion for get_zone_directory()
Antony Bowesman
adb at thorntothehorn.org
Mon Oct 31 22:44:42 PDT 2011
Current logic for windows, when building with USE_BUILTIN_TZDATA, to determine
the path to timezone zoneinfo directory is to take app .exe location and then go
up to the PARENT directory of the app before starting to look for zoneinfo.
This prevents the zoneinfo directory from existing at the same level as the app.
This requires the model as described in the comments that the app is in some
'bin' directory. This is often not the case on Windows.
What about this, which searches current directory BEFORE going up a level?
do {
dirslash = _mbsrchr (buffer, '\\');
/* Always search current directory before shifting up one */
strcpy (zoneinfodir, ZONEINFO_DIRECTORY);
while ((zislash = _mbschr (zoneinfodir, '/'))) {
*zislash = '.';
strcpy (dirname, buffer);
strcat (dirname, "/");
strcat (dirname, zislash + 1);
if (stat (dirname, &st) == 0
S_ISDIR (st.st_mode)) {
cache = strdup (dirname);
return cache;
}
}
/* Strip one more directory from app .exe location */
if (dirslash)
*dirslash = '\0';
} while (dirslash);
More information about the libical-devel
mailing list