The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
DirSearchPath.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
16#include <GaudiKernel/Kernel.h> /* GAUDI_API */
17#include <boost/filesystem/exception.hpp> /*filesystem_error*/
18#include <boost/filesystem/path.hpp>
19#include <functional> /* binary_function */
20#include <list>
21#include <string>
22#include <vector>
23
29public:
30 typedef boost::filesystem::path path;
31
33
36 DirSearchPath( const std::string& stringifiedPath, const char* separator = ",:" );
38
40
41 // bool add(const std::string& dirName); ///< \throws filesystem_error
42 bool add( const path& dir );
43 bool addCWD();
45
47
48
50 bool find( const std::string& fileName, std::string& fullFileName ) const;
52 bool find( const path& file, path& fileFound ) const;
54 std::list<path> find_all( const path& file ) const;
56
58
59 static bool existsDir( const std::string& dirName );
60 static bool existsDir( const path& dir );
62
63private:
64 //
66 struct eqPath {
67 eqPath( const path& ref ) : m_ref( ref ) {}
68 bool operator()( const path& p ) const { return p.string() == m_ref.string(); }
69
70 private:
72 };
73 // @class lessPath order paths by (system-independent) name
74 // struct lessPath : public std::binary_function<const path&,const path&,bool> {
75 // bool operator() (const path& lhs, const path& rhs) const {
76 // return lhs.string() < rhs.string();
77 // }
78 //};
80
81 // typedef std::set<path, lessPath> PathSet; ///<a set ordered by path name
82 // PathSet m_dirs; ///<the dir container
83 //
84 std::vector<path> m_dirs;
85};
#define GAUDI_API
Definition Kernel.h:49
search for files in a list of directories
boost::filesystem::path path
bool addCWD()
add current work dir (*nix pwd) to path
std::vector< path > m_dirs
the dir container
eqPath(const path &ref)
bool operator()(const path &p) const