Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Malvineous/cfgpath
Cross platform C header for obtaining paths to user configuration files and directories
https://github.com/Malvineous/cfgpath
Last synced: 3 months ago
JSON representation
Cross platform C header for obtaining paths to user configuration files and directories
- Host: GitHub
- URL: https://github.com/Malvineous/cfgpath
- Owner: Malvineous
- License: unlicense
- Created: 2013-08-24T11:51:44.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T01:01:38.000Z (7 months ago)
- Last Synced: 2024-05-02T16:09:19.976Z (6 months ago)
- Language: C
- Size: 19.5 KB
- Stars: 57
- Watchers: 7
- Forks: 16
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- AwesomeCppGameDev - cfgpath
README
cfgpath.h: Cross platform methods for obtaining paths to configuration files
============================================================================
Copyright 2013 Adam Nielsen---
This is a simple header file that provides a handful of functions to obtain
paths to configuration files, regardless of the operating system the
application is running under.It requires no dependencies beyond each platform's standard API.
This code is placed in the public domain. You are free to use it for any
purpose. If you add new platform support, please contribute a patch!Basic use:
#include "cfgpath.h"
char cfgdir[MAX_PATH];
get_user_config_file(cfgdir, sizeof(cfgdir), "myapp");
if (cfgdir[0] == 0) {
printf("Unable to find home directory.\n");
return 1;
}
printf("Saving configuration file to %s\n", cfgdir);To integrate it into your own project, just copy cfgpath.h. All the other
files are for testing to make sure it works correctly, so you don't need them
unless you intend to make changes and send me a patch.Supported platforms are currently:
* Linux
* Mac OS X
* WindowsPatches adding support for more platforms would be greatly appreciated.