Skip to content

Commit

Permalink
fpm_environment: lower windows check precedance in get_os_type function
Browse files Browse the repository at this point in the history
  • Loading branch information
sloorush committed Nov 22, 2022
1 parent 440272a commit a5ee46f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/fpm_environment.f90
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@ integer function get_os_type() result(r)
first_run = .false.
r = OS_UNKNOWN

! Check environment variable `OS`.
call get_environment_variable('OS', val, length, rc)

if (rc == 0 .and. length > 0 .and. index(val, 'Windows_NT') > 0) then
r = OS_WINDOWS
ret = r
return
end if

! Check environment variable `OSTYPE`.
call get_environment_variable('OSTYPE', val, length, rc)

Expand Down Expand Up @@ -114,6 +105,15 @@ integer function get_os_type() result(r)
end if
end if

! Check environment variable `OS`.
call get_environment_variable('OS', val, length, rc)

if (rc == 0 .and. length > 0 .and. index(val, 'Windows_NT') > 0) then
r = OS_WINDOWS
ret = r
return
end if

! Linux
inquire (file='/etc/os-release', exist=file_exists)

Expand Down

0 comments on commit a5ee46f

Please sign in to comment.