const char * osal_get_shared_filepath(const char *filename, const char *firstsearch, const char *secondsearch) { static char retpath[PATH_MAX]; int i; /* if caller gave us any directories to search, then look there first */ if (firstsearch != NULL && search_dir_file(retpath, firstsearch, filename) == 0) return retpath; if (secondsearch != NULL && search_dir_file(retpath, secondsearch, filename) == 0) return retpath; #ifdef __APPLE__ /* Special case : OS X bundles */ static char buf[1024]; if (macSetBundlePath(buf)) { sprintf(retpath, "%s%s", buf, filename); return retpath; } #endif /* otherwise check our standard paths */ for (i = 0; i < datasearchdirs; i++) { if (search_dir_file(retpath, datasearchpath[i], filename) == 0) return retpath; } /* we couldn't find the file */ return NULL; }
const char * osal_get_shared_filepath(const char *filename, const char *firstsearch, const char *secondsearch) { static char retpath[_MAX_PATH]; int i; /* if caller gave us any directories to search, then look there first */ if (firstsearch != NULL && search_dir_file(retpath, firstsearch, filename) == 0) return retpath; if (secondsearch != NULL && search_dir_file(retpath, secondsearch, filename) == 0) return retpath; /* otherwise check our standard paths */ if (search_dir_file(retpath, osal_get_user_configpath(), filename) == 0) return retpath; for (i = 0; i < datasearchdirs; i++) { if (search_dir_file(retpath, datasearchpath[i], filename) == 0) return retpath; } /* we couldn't find the file */ return NULL; }