Removed # and added new error message case
parent
ad5e1fd8d4
commit
13f5429dae
|
@ -516,8 +516,10 @@ mut args := ''
|
||||||
|
|
||||||
fn (c &V) v_files_from_dir(dir string) []string {
|
fn (c &V) v_files_from_dir(dir string) []string {
|
||||||
mut res := []string
|
mut res := []string
|
||||||
if !os.dir_exists(dir) {
|
if !os.file_exists(dir) {
|
||||||
panic('$dir doesn\'t exist')
|
panic('$dir doesn\'t exist')
|
||||||
|
} else if !os.dir_exists(dir) {
|
||||||
|
panic('$dir isn\'t a directory')
|
||||||
}
|
}
|
||||||
mut files := os.ls(dir)
|
mut files := os.ls(dir)
|
||||||
if c.is_verbose {
|
if c.is_verbose {
|
||||||
|
|
11
os/os.v
11
os/os.v
|
@ -332,13 +332,10 @@ pub fn file_exists(path string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dir_exists(path string) bool {
|
pub fn dir_exists(path string) bool {
|
||||||
res := false
|
dir := C.opendir(path.cstr())
|
||||||
if file_exists(path) {
|
res := !isnil(dir)
|
||||||
# DIR *dir = opendir(path.str);
|
if res {
|
||||||
# res = dir != NULL;
|
C.closedir(dir)
|
||||||
if res {
|
|
||||||
# closedir(dir);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue