-
Notifications
You must be signed in to change notification settings - Fork 191
stdlib_system
: essential path functionality
#999
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
base: master
Are you sure you want to change the base?
Conversation
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. |
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 |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @wassup05! Thanks for this nice work!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces essential path manipulation functions and related operator overloads to simplify path handling across platforms. Key changes include:
- Implementation of joinpath (and its operator(/)) for concatenating paths.
- Addition of splitpath and its derivatives (basename, dirname) for decomposing paths.
- Updates to tests, examples, documentation, and build files to support and illustrate the new functionality.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/system/test_path.f90 | Adds unit tests for new path functions and operator functionality. |
test/system/CMakeLists.txt | Registers the new "path" test. |
src/stdlib_system_path.f90 | Implements joinpath, operator(/), splitpath, basename, and dirname. |
src/stdlib_system.F90 | Defines interfaces and exports for the new path functionality. |
src/CMakeLists.txt | Includes the new path source file in the build. |
example/system/*.f90 | Provides usage examples for joinpath, splitpath, dirname, and basename. |
doc/specs/stdlib_system.md | Updates the spec documentation to incorporate the new interfaces. |
config/fypp_deployment.py | Passes the uppercase system name flag to the build commands. |
CMakeLists.txt | Adds compile options to define the system name macro. |
Comments suppressed due to low confidence (2)
example/system/example_path_dirname.f90:2
- The program name 'example_path_splitpath' does not match the file's purpose (dirname functionality). Consider renaming it to 'example_path_dirname'.
program example_path_splitpath
example/system/example_path_basename.f90:2
- The program name 'example_path_splitpath' in this file appears to be a copy-paste error; it should reflect basename functionality (e.g., 'example_path_basename').
program example_path_splitpath
A few path related functions for ease of future functionality have been added.
joinpath
: joins the given paths according to the platform'spath-separator
.operator(/)
: as was suggested in the Fortran discourse here an operator is also provided for the same functionalitysplitpath
: splits the path following the lastpath-separator
and returns thehead
andtail
.basename
: just returns thetail
ofsplitpath
dirname
: just returns thehead
ofsplitpath
The
pathsep
parameter
contains either/
or\
depending on the platform and is a compile-time constant now, so is theparameter
,ISWIN
Do let me know your thoughts.