is_windows Function

function is_windows() result(windows)

Try to determine if we run on Windows and don’t have POSIX compliance around

Arguments

None

Return Value logical

Operating system seems to be Windows


Contents

Source Code


Source Code

function is_windows() result(windows)

   !> Operating system seems to be Windows
   logical :: windows

   character(len=:), allocatable :: tmp

   windows = .false.
   call get_variable('OS', tmp)
   if (allocated(tmp)) then
      windows = index(tmp, 'Windows_NT') > 0
   end if
   if (.not.windows) then
      call get_variable('OSTYPE', tmp)
      if (allocated(tmp)) then
         windows = index(tmp, 'win') > 0 .or. index(tmp, 'msys') > 0
      end if
   end if

end function is_windows