unit tests: add TAP unit test framework
[alt-git.git] / abspath.h
blob7cd3de5e9de5391381dfa6a28a43bb709e4b04c4
1 #ifndef ABSPATH_H
2 #define ABSPATH_H
4 int is_directory(const char *);
5 char *strbuf_realpath(struct strbuf *resolved, const char *path,
6 int die_on_error);
7 char *strbuf_realpath_forgiving(struct strbuf *resolved, const char *path,
8 int die_on_error);
9 char *real_pathdup(const char *path, int die_on_error);
10 const char *absolute_path(const char *path);
11 char *absolute_pathdup(const char *path);
14 * Concatenate "prefix" (if len is non-zero) and "path", with no
15 * connecting characters (so "prefix" should end with a "/").
16 * Unlike prefix_path, this should be used if the named file does
17 * not have to interact with index entry; i.e. name of a random file
18 * on the filesystem.
20 * The return value is always a newly allocated string (even if the
21 * prefix was empty).
23 char *prefix_filename(const char *prefix, const char *path);
25 /* Likewise, but path=="-" always yields "-" */
26 char *prefix_filename_except_for_dash(const char *prefix, const char *path);
28 static inline int is_absolute_path(const char *path)
30 return is_dir_sep(path[0]) || has_dos_drive_prefix(path);
33 #endif /* ABSPATH_H */