Ok, from this pull, can not see the whole function...

then this piece of code is replicated to the directory/symlink one. You can use another form of `if()` to eliminate the replicated code.