]> git.donarmstrong.com Git - lilypond.git/blob - flower/include/file-path.hh
8c8049391d9b5e1c1834643752b5818cf776c329
[lilypond.git] / flower / include / file-path.hh
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef FILE_PATH_HH
21 #define FILE_PATH_HH
22
23 #include "std-vector.hh"
24 #include "std-string.hh"
25
26 /**
27    search in directories for a file.
28
29    Abstraction of PATH variable. An interface for searching input files.
30    Search a number of dirs for a file.
31
32    TODO: add a unix style PATH interface
33 */
34
35 class File_path
36 {
37   vector<string> dirs_;
38
39 public:
40   vector<string> directories () const;
41   string find (const string &name) const;
42   string find (const string &name, char const *extensions[]);
43   string to_string () const;
44   bool try_append (string str);
45   void append (const string&);
46   void parse_path (const string&);
47   void prepend (const string&);
48 };
49
50 bool is_file (const string &file_name);
51 bool is_dir (string file_name);
52
53 #endif /* FILE_PATH */