@@ -6,14 +6,15 @@ module fpm_filesystem
6
6
OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_WINDOWS, &
7
7
OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_OPENBSD
8
8
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
10
10
use iso_c_binding, only: c_char, c_ptr, c_int, c_null_char, c_associated, c_f_pointer
11
11
use fpm_error, only : fpm_stop
12
12
implicit none
13
13
private
14
14
public :: basename, canon_path, dirname, is_dir, join_path, number_of_rows, list_files, env_variable, &
15
15
mkdir, exists, get_temp_filename, windows_path, unix_path, getline, delete_file
16
16
public :: fileopen, fileclose, filewrite, warnwrite, parent_dir
17
+ public :: is_hidden_file
17
18
public :: read_lines, read_lines_expanded
18
19
public :: which, run, LINE_BUFFER_LEN
19
20
@@ -250,6 +251,15 @@ logical function is_dir(dir)
250
251
251
252
end function is_dir
252
253
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
253
263
254
264
! > Construct path by joining strings with os file separator
255
265
function join_path (a1 ,a2 ,a3 ,a4 ,a5 ) result(path)
0 commit comments