Skip to content

feat: path functions is_abs and abs_path#1027

Open
wassup05 wants to merge 9 commits into
fortran-lang:masterfrom
wassup05:abs_path
Open

feat: path functions is_abs and abs_path#1027
wassup05 wants to merge 9 commits into
fortran-lang:masterfrom
wassup05:abs_path

Conversation

@wassup05

@wassup05 wassup05 commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

User facing functions added are:

  • is_abs(path): returns a logical indicating if the path is absolute.
  • abs_path(path [, err]): returns the absolutized version of the path.

is_abs does pure string manipulation checking if

  • on POSIX systems, path starts with /
  • on Windows systems it is either an UNC path or starts with a drive letter like C:\

abs_path performs a syscall to get the current working directory and then joins it to the path, returning the joined path

Prior Art

os.path.abspath (Python)
os.path.isabs (Python)

@sebastian-mutz sebastian-mutz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @wassup05!
I'm wondering if is_abs_path may be better to use. While "path" is the first thing many will think of from context, it is entirely implied. Even in the use statement stdlib_system, only: is_abs, it's not visible (c.f. Python's os.path.isabs).

Comment thread doc/specs/stdlib_system.md Outdated
Comment thread doc/specs/stdlib_system.md Outdated
@wassup05

Copy link
Copy Markdown
Contributor Author

I had that in mind too @sebastian-mutz, and I have changed it now.

@sebastian-mutz sebastian-mutz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the recent change, @wassup05. Many thanks.

Comment thread src/system/stdlib_system_path.f90
Comment thread src/system/stdlib_system_path.f90
@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.25243% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.94%. Comparing base (1c534cb) to head (a3df735).
⚠️ Report is 41 commits behind head on master.

Files with missing lines Patch % Lines
test/system/test_path.f90 67.64% 22 Missing ⚠️
example/system/example_path_abs.f90 0.00% 11 Missing ⚠️
src/system/stdlib_system_path.f90 58.33% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1027      +/-   ##
==========================================
- Coverage   68.05%   67.94%   -0.11%     
==========================================
  Files         402      403       +1     
  Lines       12839    12942     +103     
  Branches     1383     1406      +23     
==========================================
+ Hits         8738     8794      +56     
- Misses       4101     4148      +47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants