diff --git a/code/C_helper.c b/code/C_helper.c new file mode 100644 index 000000000..950a5999e --- /dev/null +++ b/code/C_helper.c @@ -0,0 +1,24 @@ +/* Unix */ +#include +#include +#include +#include + +#define GETCWD getcwd + + +void getCurrentWorkDir(char *str,int *stat){ + if(GETCWD(str, sizeof(str)) == str){ + *stat = 0; + } + else{ + *stat = 1; + } +} + +int isDirectory(const char *path){ + struct stat statbuf; + if(stat(path, &statbuf) != 0) + return 0; + return S_ISDIR(statbuf.st_mode); +} diff --git a/code/IO.f90 b/code/IO.f90 index 1a36269c5..57eb23cb5 100644 --- a/code/IO.f90 +++ b/code/IO.f90 @@ -1237,8 +1237,7 @@ character(len=300) pure function IO_extractValue(pair,key) IO_extractValue = '' myChunk = scan(pair,SEP) - if (myChunk > 0 .and. pair(:myChunk-1) == key(:myChunk-1)) & - IO_extractValue = pair(myChunk+1:) ! extract value if key matches + if (myChunk > 0 .and. pair(:myChunk-1) == key) IO_extractValue = pair(myChunk+1:) ! extract value if key matches end function IO_extractValue