stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

`stdlib_system`: essential path functionality

Open wassup05 opened this issue 7 months ago • 3 comments

A few path related functions for ease of future functionality have been added.

  • joinpath: joins the given paths according to the platform's path-separator.
  • operator(/): as was suggested in the Fortran discourse here an operator is also provided for the same functionality
  • splitpath: splits the path following the last path-separator and returns the head and tail.
  • basename: just returns the tail of splitpath
  • dirname: just returns the head of splitpath

The pathsep parameter contains either / or \ depending on the platform and is a compile-time constant now, so is the parameter, ISWIN

Do let me know your thoughts.

wassup05 avatar Jun 07 '25 10:06 wassup05

Thanks for the PR, @wassup05. Just a minor point (not related to functionality) about examples for now: It's always useful - esp. for those learning by examples - to have an idea of the expected output. Other stdlib examples add the expected print results as a comment below the respective commands. I would recommend to do the same here.

sebastian-mutz avatar Jun 10 '25 14:06 sebastian-mutz

I will add that with the other reviews @sebastian-mutz, I don't want to trigger the ci/cd workflow just for a few comments. Also on a second thought maybe instead of the if (ISWIN) ... thing I could separate the two examples...

wassup05 avatar Jun 11 '25 16:06 wassup05

The issue with Ninja detecting a "circular dependency" (there was non) was related to the stdlib_system.F90 file not being visible in a correct manner in the CMakeLists.txt file.

The group:

# Preprocessed files to contain preprocessor directives -> .F90
set(cppFiles

corresponds to .fypp files for which the suffix should be changed to .F90. Not for already .F90 files.

jalvesz avatar Jun 15 '25 18:06 jalvesz

In absence of further comments, I will merge this one, thank you.

perazz avatar Jul 22 '25 13:07 perazz