1 /* 2 * Copyright 2013, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PATH_FINDER_H 6 #define _PATH_FINDER_H 7 8 9 #include <FindDirectory.h> 10 #include <String.h> 11 12 13 class BPath; 14 class BStringList; 15 struct entry_ref; 16 17 18 namespace BPackageKit { 19 class BPackageResolvableExpression; 20 } 21 22 23 class BPathFinder { 24 public: 25 typedef BPackageKit::BPackageResolvableExpression 26 BResolvableExpression; 27 28 public: 29 BPathFinder(const void* codePointer = NULL, 30 const char* dependency = NULL); 31 BPathFinder(const char* path, 32 const char* dependency = NULL); 33 BPathFinder(const entry_ref& ref, 34 const char* dependency = NULL); 35 BPathFinder( 36 const BResolvableExpression& expression, 37 const char* dependency = NULL); 38 // requires libpackage 39 40 status_t SetTo(const void* codePointer = NULL, 41 const char* dependency = NULL); 42 status_t SetTo(const char* path, 43 const char* dependency = NULL); 44 status_t SetTo(const entry_ref& ref, 45 const char* dependency = NULL); 46 status_t SetTo(const BResolvableExpression& expression, 47 const char* dependency = NULL); 48 // requires libpackage 49 50 status_t FindPath(const char* architecture, 51 path_base_directory baseDirectory, 52 const char* subPath, uint32 flags, 53 BPath& _path); 54 status_t FindPath(path_base_directory baseDirectory, 55 const char* subPath, uint32 flags, 56 BPath& _path); 57 status_t FindPath(path_base_directory baseDirectory, 58 const char* subPath, BPath& _path); 59 status_t FindPath(path_base_directory baseDirectory, 60 BPath& _path); 61 62 static status_t FindPaths(const char* architecture, 63 path_base_directory baseDirectory, 64 const char* subPath, uint32 flags, 65 BStringList& _paths); 66 static status_t FindPaths(path_base_directory baseDirectory, 67 const char* subPath, uint32 flags, 68 BStringList& _paths); 69 static status_t FindPaths(path_base_directory baseDirectory, 70 const char* subPath, BStringList& _paths); 71 static status_t FindPaths(path_base_directory baseDirectory, 72 BStringList& _paths); 73 74 private: 75 status_t _SetTo(const void* codePointer, 76 const char* path, const char* dependency); 77 78 private: 79 const void* fCodePointer; 80 BString fPath; 81 BString fDependency; 82 status_t fInitStatus; 83 addr_t fReserved[4]; 84 }; 85 86 87 #endif // _PATH_FINDER_H 88