Remove some duplicate code
This commit is contained in:
parent
c08c802bf3
commit
3f8576a6ab
4 changed files with 22 additions and 21 deletions
|
@ -301,12 +301,8 @@ static void findRoots(StoreAPI & store, const Path & path, unsigned char type, R
|
|||
{
|
||||
try {
|
||||
|
||||
if (type == DT_UNKNOWN) {
|
||||
struct stat st = lstat(path);
|
||||
if (S_ISDIR(st.st_mode)) type = DT_DIR;
|
||||
else if (S_ISLNK(st.st_mode)) type = DT_LNK;
|
||||
else if (S_ISREG(st.st_mode)) type = DT_REG;
|
||||
}
|
||||
if (type == DT_UNKNOWN)
|
||||
type = getFileType(path);
|
||||
|
||||
if (type == DT_DIR) {
|
||||
for (auto & i : readDirectory(path))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue