]>
Commit | Line | Data |
---|---|---|
0b027f6c EN |
1 | #ifndef ABSPATH_H |
2 | #define ABSPATH_H | |
3 | ||
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); | |
12 | ||
13 | /* | |
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. | |
19 | * | |
20 | * The return value is always a newly allocated string (even if the | |
21 | * prefix was empty). | |
22 | */ | |
23 | char *prefix_filename(const char *prefix, const char *path); | |
24 | ||
25 | /* Likewise, but path=="-" always yields "-" */ | |
26 | char *prefix_filename_except_for_dash(const char *prefix, const char *path); | |
27 | ||
28 | static inline int is_absolute_path(const char *path) | |
29 | { | |
30 | return is_dir_sep(path[0]) || has_dos_drive_prefix(path); | |
31 | } | |
32 | ||
33 | #endif /* ABSPATH_H */ |