@@ -6,14 +6,15 @@ module fpm_filesystem
66 OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_WINDOWS, &
77 OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_OPENBSD
88 use fpm_environment, only: separator, get_env, os_is_unix
9- use fpm_strings, only: f_string, replace, string_t, split, notabs
9+ use fpm_strings, only: f_string, replace, string_t, split, notabs, str_begins_with_str
1010 use iso_c_binding, only: c_char, c_ptr, c_int, c_null_char, c_associated, c_f_pointer
1111 use fpm_error, only : fpm_stop
1212 implicit none
1313 private
1414 public :: basename, canon_path, dirname, is_dir, join_path, number_of_rows, list_files, env_variable, &
1515 mkdir, exists, get_temp_filename, windows_path, unix_path, getline, delete_file
1616 public :: fileopen, fileclose, filewrite, warnwrite, parent_dir
17+ public :: is_hidden_file
1718 public :: read_lines, read_lines_expanded
1819 public :: which, run, LINE_BUFFER_LEN
1920
@@ -250,6 +251,15 @@ logical function is_dir(dir)
250251
251252end function is_dir
252253
254+ ! > test if a file is hidden
255+ logical function is_hidden_file (file_basename ) result(r)
256+ character (* ), intent (in ) :: file_basename
257+ if (len (file_basename) <= 2 ) then
258+ r = .false.
259+ else
260+ r = str_begins_with_str(file_basename, ' .' )
261+ end if
262+ end function is_hidden_file
253263
254264! > Construct path by joining strings with os file separator
255265function join_path (a1 ,a2 ,a3 ,a4 ,a5 ) result(path)
0 commit comments