-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to list directory content #141
Comments
For cross-platform you need this. Otherwise, I think the next best kludge would be to |
We need a temporary solution so that we are not stuck on this, and can move on, and in the meantime we can work on the full general solution. |
I agree. I think wrapping around the shell commands on each OS is the way to go. |
It seems like it. How do you determine which OS you are on from Fortran? |
Perhaps we can test the value of an environment variable ( |
Good idea, the |
I'd put it behind a function and just use preprocessor directives. Something like: function is_windows()
logical :: is_windows
#ifdef (WIN_32)
is_windows = .true.
#elif
is_windows = .false.
#endif Obviously you'll need to look up the proper syntax and tests, but that way, even if you change the way it's done, it shouldn't require changing any other code anywhere. |
@everythingfunctional ah that's right, I think that should work. |
I didn't know fpm supported preprocessing. 👍 in that case. |
fpm isn't doing any preprocessing, but our currently only supported compiler does a bit ;). Should be enough to solve at least the "Is this Windows or not?" question. |
I just tried: on Windows "dir /b" gives the bare list of file names, just as "ls". That means that only the command is different - not the format of the output (with out "/b" you get a lot of rubbish ;)). |
@everythingfunctional so the ifdef trick does not work with gfortran to determine the OS, I tried that in #142, and it does not work on linux, nor anywhere else... Let's further discuss this OS determination in #144. |
Thanks @arjenmarkus. I will try to do this once #142 is merged, as I need to determine the OS type first to know which command to run. |
Until stdlib can be included, perhaps linking an ISO C binding abstraction layer to either POSIX and Win32 routines at compile time may be sufficient. |
This has been resolved by #507 |
In order to move beyond #137, we need a cross-platform way to read all the
*.f90
files in a directory. What is the best way to do that in Fortran?The text was updated successfully, but these errors were encountered: