diff options
| author | Jakob Pfender <jpfender@elegosoft.com> | 2011-06-07 14:10:06 +0200 |
|---|---|---|
| committer | Jakob Pfender <jpfender@elegosoft.com> | 2011-06-07 14:10:06 +0200 |
| commit | fdd1e04ce766c40be90a7b07580842a3f8d76b2e (patch) | |
| tree | 08b01e042efbbae74a57a6b1497f4013a4fb14be /src/fileops.c | |
| parent | ee4912bf795237cb235b3d6533e9046fcd7e12b7 (diff) | |
| download | libgit2-fdd1e04ce766c40be90a7b07580842a3f8d76b2e.tar.gz | |
fileops: Allow differentiation between deep and shallow exists()
When calling gitfo_exists() on a symbolic link, sometimes we need to
simply check whether the link exists and sometimes we need to check
whether the file pointed to by the symlink exists.
Introduce a new function gitfo_shallow_exists that only checks if the
link exists and revert gitfo_exists to the original functionality of
checking whether the file pointed to by the link exists.
Diffstat (limited to 'src/fileops.c')
| -rw-r--r-- | src/fileops.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fileops.c b/src/fileops.c index 92b95c5dd..b11119b91 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -172,6 +172,12 @@ int gitfo_isfile(const char *path) int gitfo_exists(const char *path) { assert(path); + return access(path, F_OK); +} + +int gitfo_shallow_exists(const char *path) +{ + assert(path); struct stat st; return gitfo_lstat(path, &st); |
