Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
bc648491
Commit
bc648491
authored
Jun 03, 2011
by
Romain Geissler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fileops: Added gitfo_isfile.
Conflicts: src/fileops.c
parent
26a98ec8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
+21
-1
src/fileops.c
+20
-1
src/fileops.h
+1
-0
No files found.
src/fileops.c
View file @
bc648491
...
...
@@ -131,7 +131,26 @@ int gitfo_isdir(const char *path)
return
git__throw
(
GIT_ENOTFOUND
,
"%s does not exist"
,
path
);
if
(
!
S_ISDIR
(
st
.
st_mode
))
return
git__throw
(
GIT_ENOTFOUND
,
"%s is a file"
,
path
);
return
git__throw
(
GIT_ENOTFOUND
,
"%s is not a directory"
,
path
);
return
GIT_SUCCESS
;
}
int
gitfo_isfile
(
const
char
*
path
)
{
struct
stat
st
;
int
stat_error
;
if
(
!
path
)
return
git__throw
(
GIT_ENOTFOUND
,
"No path given to gitfo_isfile"
);
stat_error
=
gitfo_stat
(
path
,
&
st
);
if
(
stat_error
<
GIT_SUCCESS
)
return
git__throw
(
GIT_ENOTFOUND
,
"%s does not exist"
,
path
);
if
(
!
S_ISREG
(
st
.
st_mode
))
return
git__throw
(
GIT_ENOTFOUND
,
"%s is not a file"
,
path
);
return
GIT_SUCCESS
;
}
...
...
src/fileops.h
View file @
bc648491
...
...
@@ -67,6 +67,7 @@ extern int gitfo_creat(const char *path, int mode);
extern
int
gitfo_creat_force
(
const
char
*
path
,
int
mode
);
extern
int
gitfo_mktemp
(
char
*
path_out
,
const
char
*
filename
);
extern
int
gitfo_isdir
(
const
char
*
path
);
extern
int
gitfo_isfile
(
const
char
*
path
);
extern
int
gitfo_mkdir_recurs
(
const
char
*
path
,
int
mode
);
extern
int
gitfo_mkdir_2file
(
const
char
*
path
);
#define gitfo_close(fd) close(fd)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment