Skip to main content

News

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

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere 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
miniSphere 5.0b4 (stable: 4.8.8) - Cell compiler - SSj debugger - thread | on GitHub
For the sake of our continued health I very much hope that Fat Cerberus does not become skilled enough at whatever arcane art it would require to cause computers to spawn enourmous man eating pigs ~Rhuan