14 USE mo_kind,
ONLY : i4
30 subroutine check_dir(path, text, raise, tab, text_length)
32 use mo_constants,
ONLY : nout, nerr
33 use mo_message,
only : message, show_msg, show_err
34 use mo_os,
only : path_split, path_isdir
38 CHARACTER(LEN=*),
INTENT(IN) :: path
39 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: text
40 LOGICAL,
INTENT(IN),
OPTIONAL :: raise
41 integer(i4),
INTENT(in),
OPTIONAL :: tab
42 integer(i4),
INTENT(in),
OPTIONAL :: text_length
46 integer(i4) :: text_length_, uni
47 LOGICAL :: is_dir, error, show
48 CHARACTER(len=255) :: head, tail, info, prefix_info, ws, text_
56 if (
present(text)) text_ = text
57 if (
present(raise)) raise_ = raise
58 if (
present(tab)) tab_ = tab
59 text_length_ = len_trim(text_)
60 if (
present(text_length)) text_length_ = text_length
63 call path_split(path, head, tail)
65 is_dir = path_isdir(head)
68 info = trim(head) //
" (found)"
70 info = trim(head) //
" (not found)"
72 if ( len_trim(tail) > 0 ) prefix_info =
"added file prefix: " // trim(tail)
74 error = .not. is_dir .and. raise_
85 ws(1:max(0, text_length_-len_trim(text_))), &
subroutine, public check_dir(path, text, raise, tab, text_length)
Check if a given directory exists.