mirror of
https://github.com/roswell/roswell.git
synced 2026-09-10 07:16:17 -04:00
get rid of '..' and '.' from result of directory.
This commit is contained in:
parent
def9aea3c0
commit
4753f95973
11
src/util.c
11
src/util.c
|
|
@ -66,10 +66,13 @@ LVal directory(char* path) {
|
|||
if(dir==NULL)
|
||||
return 0;
|
||||
while((dirent=readdir(dir))!=0) {
|
||||
char* str=q(dirent->d_name);
|
||||
if(dirent->d_type & DT_DIR)
|
||||
str=s_cat2(str,q("/"));
|
||||
ret=conss(str,ret);
|
||||
if(!(strcmp(dirent->d_name,".")==0 ||
|
||||
strcmp(dirent->d_name,"..")==0)) {
|
||||
char* str=q(dirent->d_name);
|
||||
if(dirent->d_type & DT_DIR)
|
||||
str=s_cat2(str,q("/"));
|
||||
ret=conss(str,ret);
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue