Skip to main content

News

Topic: General-purpose path parsing for C (Read 3633 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • Sphere Developer
General-purpose path parsing for C
In the process of implementing Cell, I ended up writing this nifty set of path parsing functions along the way to replace the Allegro path API:
https://github.com/fatcerberus/minisphere/blob/master/src/path.c
https://github.com/fatcerberus/minisphere/blob/master/src/path.h

This turned into quite a robust set of routines, far beyond the limited set provided by Allegro.  You have your basic concatenation, of course (path_rebase(), path_cat()), and I also added routines for normalization (path_collapse()), canonization against the file system (path_resolve(), which can also relativize), even a recursive path_mkdir().  When you're done building the path, just do path_cstr(path_obj) to get the final path string for use with file system functions.

Feel free to use it. :)  Consider it MIT licensed like the rest of minisphere.
  • Last Edit: October 23, 2015, 01:27:01 am by Lord English
neoSphere 5.9.2 - neoSphere engine - Cell compiler - SSj debugger
forum thread | on GitHub