4 * Copyright (c) Freescale Semiconductor, Inc. All rights reserved.
5 * See included license file for license details.
7 #if !defined(_searchpath_h_)
14 * \brief Handles searching a list of paths for a file.
27 typedef enum _target_type target_type_t;
30 //! Global search object singleton.
31 static PathSearcher * s_searcher;
34 //! \brief Access global path searching object.
35 static PathSearcher & getGlobalSearcher();
38 //! \brief Constructor.
41 //! \brief Add a new search path to the end of the list.
42 void addSearchPath(std::string & path);
44 //! \brief Attempts to locate a file by using the search paths.
45 bool search(const std::string & base, target_type_t targetType, bool searchCwd, std::string & result);
48 typedef std::list<std::string> string_list_t; //!< Linked list of strings.
49 string_list_t m_paths; //!< Ordered list of paths to search.
51 //! \brief Returns whether \a path is absolute.
52 bool isAbsolute(const std::string & path);
54 //! \brief Combines two paths into a single one.
55 std::string joinPaths(const std::string & first, const std::string & second);
58 #endif // _searchpath_h_