Skip to main content
↑
↓
Spherical forums
Community for the
Sphere game engine
New?
Contact Us
to register an account!
1 Hour
1 Day
1 Week
1 Month
Forever
Community
Help
Search
Recent Posts
Log in
Contact Us
News
Spherical
Facebook
-
Twitter
-
Discord chat
New?
Contact us
to register an account!
Creations
Programming
General-purpose path parsing for C
1
Print
Topic: General-purpose path parsing for C
(Read 3664 times)
previous topic
-
next topic
0 Members and 1 Guest are viewing this topic.
Fat Cerberus
Big Chungus
Posts: 2,774
*MUNCH*
Logged
Global Moderator
Sphere Developer
General-purpose path parsing for C
October 23, 2015, 01:24:04 am
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
1
Print
Creations
Programming
General-purpose path parsing for C