From ca88004739a2079719de12c96caa988c605dc6a3 Mon Sep 17 00:00:00 2001 From: Casper Date: Fri, 26 Apr 2024 15:50:53 +0800 Subject: [PATCH] fixed a windows bug in make_dir_path --- Makefile | 13 +++++++++++++ src/aed_util.F90 | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/Makefile b/Makefile index b49c607..d0ad6c0 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,16 @@ # # ############################################################################### +ifeq ($(shell uname),Linux) + OSTYPE=$(shell uname -s) +else ifeq ($(shell uname),Darwin) + OSTYPE=$(shell uname -s) +else ifeq ($(shell uname),FreeBSD) + OSTYPE=$(shell uname -s) +else + OSTYPE=$(shell uname -o) +endif + srcdir=src incdir=include @@ -85,6 +95,9 @@ else # we use std=f2008ts rather than f2008 because ts removes some type checking # restrictions on interoperabilty routines (which were wrong anyway...) FFLAGS=-fPIC -Wall -J ${moddir} -ffree-line-length-none -std=f2008ts + ifeq ($(OSTYPE),Msys) + FFLAGS+=-D_WIN32 + endif FFLAGS+=$(DEFINES) $(INCLUDES) -fall-intrinsics -Wno-unused -Wno-unused-dummy-argument FFLAGS+=-fno-range-check -Wno-integer-division ifeq ($(WITH_CHECKS),true) diff --git a/src/aed_util.F90 b/src/aed_util.F90 index 2440930..3fdddfe 100644 --- a/src/aed_util.F90 +++ b/src/aed_util.F90 @@ -1167,7 +1167,11 @@ LOGICAL FUNCTION make_dir_path(dir) INTEGER :: len, i, sys CHARACTER(len=128) :: d LOGICAL :: res = .TRUE. +#ifdef _WIN32 +# define DIRSEP "\\" +#else # define DIRSEP "/" +#endif !BEGIN !------------------------------------------------------------------------------- len = LEN_TRIM(dir)