Path parsing library (for C and C++)
libpath is a small, standalone library, implemented in C with a C and a C++ API, that provides file-system path parsing and comparison, for platform-dependent - Unix and Windows - and platform-independent path manipulation. It is intended to be useful for application-level programming as well as a basis for other libraries.
Need: a C compiler and CMake 3.20+. Tests and examples also need STLSoft 1.11.5 or later and xTests 0.29 or later. The library itself needs only the C standard library (and the C++ standard library for the C++ API).
Build:
./prepare_cmake.sh
./build_cmake.shTry:
./run_all_unit_tests.sh
./run_all_examples.shSimplest use (C):
#include <libpath/parse.h>
libpath_PathDescriptor_t desc;
libpath_Parse_ParsePathFromCStyleString("/tmp/a", 0, &desc, 0, NULL, NULL);
int const absolute = libpath_ParseResult_IsPathAbsolute(&desc);Simplest use (C++):
#include <libpath/parse.hpp>
libpath::parsing::PathDescriptor_t desc;
libpath::parsing::parse_path_from_cstyle_string("/tmp/a", 0, &desc, 0, nullptr);
int const absolute = libpath_ParseResult_IsPathAbsolute(&desc);Read next: INSTALL.md for installation, the examples directory for usage, and FAQ.md for common questions.
Detailed instructions - via CMake - are provided in the accompanying INSTALL.md file.
- Comparing API (C and C++);
- Equating API (C and C++);
- Parsing API (C and C++);
Examples are provided in the examples directory.
Defect reports, feature requests, and pull requests are welcome on https://github.com/synesissoftware/libpath.
If you'd like to help out with the project, please raise an issue via GitHub Page - you'll be very welcome!
libpath has no proper (i.e. runtime / build) dependencies outside the facilities of the C standard library and, for its C++ API, the C++ standard library.
In order to run the test programs, libpath has the following development dependencies:
libpath is released under the 3-clause BSD license. See LICENSE for details.