likle / cwalk

Path library for C/C++. Cross-Platform for Linux, FreeBSD, Windows and MacOS. Supports UNIX and Windows path styles on those platforms.
https://likle.github.io/cwalk/
MIT License
250 stars 39 forks source link

Add cwk_path_get_executable_path #21

Closed ddalcino closed 3 years ago

ddalcino commented 3 years ago

This is my first attempt at an implementation for Linux, Mac, Windows, FreeBSD, NetBSD, DragonFlyBSD, and Solaris. I wrote it based on the man pages and developer documentation for these platforms; links to the docs and summaries of relevant functions are included in the code. I'm opening this as a draft primarily to show what this code could look like, so you can decide it you really want something like this in cwalk or not.

The next steps would be to implement tests and get them running in CI on all platforms supported.

I think it would be worth it to add an implementation for OpenBSD. It's an odd OS to leave out, given that I have implementations for 3 other BSDs.

Closes #20.

codecov[bot] commented 3 years ago

Codecov Report

Merging #21 (09e0524) into master (d418a2e) will decrease coverage by 1.76%. The diff coverage is 75.00%.

:exclamation: Current head 09e0524 differs from pull request most recent head daa37e4. Consider uploading reports for the commit daa37e4 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master      #21      +/-   ##
==========================================
- Coverage   98.14%   96.38%   -1.77%     
==========================================
  Files           1        1              
  Lines         485      525      +40     
==========================================
+ Hits          476      506      +30     
- Misses          9       19      +10     
Impacted Files Coverage Δ
src/cwalk.c 96.38% <75.00%> (-1.77%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d418a2e...daa37e4. Read the comment docs.

ddalcino commented 3 years ago

Closing this because there is already a well tested library that has this function: https://github.com/gpakosz/whereami

Thanks to @kampeador for the comment in https://github.com/likle/cwalk/issues/20#issuecomment-927348444