|
a/src/utils/pathut.h |
|
b/src/utils/pathut.h |
|
... |
|
... |
14 |
* Free Software Foundation, Inc.,
|
14 |
* Free Software Foundation, Inc.,
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
15 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
16 |
*/
|
16 |
*/
|
17 |
#ifndef _PATHUT_H_INCLUDED_
|
17 |
#ifndef _PATHUT_H_INCLUDED_
|
18 |
#define _PATHUT_H_INCLUDED_
|
18 |
#define _PATHUT_H_INCLUDED_
|
19 |
/* @(#$Id: pathut.h,v 1.6 2006-01-30 11:15:28 dockes Exp $ (C) 2004 J.F.Dockes */
|
19 |
/* @(#$Id: pathut.h,v 1.7 2006-03-20 09:54:22 dockes Exp $ (C) 2004 J.F.Dockes */
|
20 |
|
20 |
|
21 |
#include <string>
|
21 |
#include <string>
|
22 |
#include <list>
|
22 |
#include <list>
|
23 |
|
23 |
|
|
|
24 |
/// Add a / at the end if none there yet.
|
24 |
extern void path_catslash(std::string &s);
|
25 |
extern void path_catslash(std::string &s);
|
|
|
26 |
/// Concatenate 2 paths
|
25 |
extern std::string path_cat(const std::string &s1, const std::string &s2);
|
27 |
extern std::string path_cat(const std::string &s1, const std::string &s2);
|
|
|
28 |
/// Get the simple file name (get rid of any directory path prefix
|
26 |
extern std::string path_getsimple(const std::string &s);
|
29 |
extern std::string path_getsimple(const std::string &s);
|
|
|
30 |
/// Simple file name + optional suffix stripping
|
27 |
extern std::string path_basename(const std::string &s, const std::string &suff="");
|
31 |
extern std::string path_basename(const std::string &s, const std::string &suff="");
|
|
|
32 |
/// Get the father directory
|
28 |
extern std::string path_getfather(const std::string &s);
|
33 |
extern std::string path_getfather(const std::string &s);
|
|
|
34 |
/// Get the current user's home directory
|
29 |
extern std::string path_home();
|
35 |
extern std::string path_home();
|
|
|
36 |
/// Expand ~ at the beginning of string
|
30 |
extern std::string path_tildexpand(const std::string &s);
|
37 |
extern std::string path_tildexpand(const std::string &s);
|
31 |
|
38 |
/// Clean up path by removing duplicated / and resolving ../
|
32 |
extern std::string path_canon(const std::string &s);
|
39 |
extern std::string path_canon(const std::string &s);
|
|
|
40 |
/// Use glob(3) to return a list of file names matching pattern inside dir
|
33 |
extern std::list<std::string> path_dirglob(const std::string &dir,
|
41 |
extern std::list<std::string> path_dirglob(const std::string &dir,
|
34 |
const std::string pattern);
|
42 |
const std::string pattern);
|
35 |
#endif /* _PATHUT_H_INCLUDED_ */
|
43 |
#endif /* _PATHUT_H_INCLUDED_ */
|