Add new API find_path[s](), find_path_for_path()

The new functions are meant to replace many uses of find_directory():
* find_paths() is supposed to be used when the directories of a certain
  kind in all installation directories are needed (e.g. font
  directories, add-on directory, etc.). Using this API makes code
  robust wrt addition or removal of installation locations.
* find_path() is supposed to be used when files/directories associated
  with a loaded program, library, or add-on need to be found (e.g. data
  files or global settings).
* find_path_for_path() is similar to find_path(), but it starts from a
  given path instead of an image.
This commit is contained in:
Ingo Weinhold
2013-11-05 21:40:43 +01:00
parent a712cdd0b1
commit 986e4abce4
4 changed files with 535 additions and 2 deletions
@@ -17,6 +17,17 @@ __BEGIN_DECLS
status_t __find_directory(directory_which which, dev_t device, bool createIt,
char *returnedPath, int32 pathLength);
status_t __find_path(const void* codePointer, const char* dependency,
path_base_directory baseDirectory, const char* subPath, uint32 flags,
char* pathBuffer, size_t bufferSize);
status_t __find_path_for_path(const char* path, const char* dependency,
path_base_directory baseDirectory, const char* subPath, uint32 flags,
char* pathBuffer, size_t bufferSize);
status_t __find_paths(path_base_directory baseDirectory, const char* subPath,
uint32 flags, char*** _paths, size_t* _pathCount);
__END_DECLS