2016-10-27 18:11:34 +00:00
|
|
|
/**
|
|
|
|
* OS specific stuff. This is going to get ugly, but at least its in one place
|
|
|
|
*/
|
|
|
|
#ifndef __OS_UTILS_H__
|
|
|
|
#define __OS_UTILS_H__
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get an environment varible from the os
|
|
|
|
* @param variable the variable to look for
|
|
|
|
* @returns the results
|
|
|
|
*/
|
|
|
|
char* os_utils_getenv(char* variable);
|
|
|
|
|
2016-10-31 16:13:42 +00:00
|
|
|
/**
|
|
|
|
* get the user's home directory
|
|
|
|
* @returns the user's home directory
|
|
|
|
*/
|
|
|
|
char* os_utils_get_homedir();
|
|
|
|
|
2016-10-27 18:11:34 +00:00
|
|
|
/**
|
|
|
|
* join 2 pieces of a filepath, being careful about the slashes
|
|
|
|
* @param root the root part
|
|
|
|
* @param extension what should be concatenated
|
|
|
|
* @param results where to put the results
|
|
|
|
* @param max_len throw an error if the total is longer than max_len
|
|
|
|
*/
|
2016-10-31 16:13:42 +00:00
|
|
|
int os_utils_filepath_join(char* root, char* extension, char* results, unsigned long max_len);
|
2016-10-27 18:11:34 +00:00
|
|
|
|
|
|
|
int os_utils_file_exists(char* file_name);
|
|
|
|
|
2016-10-31 16:13:42 +00:00
|
|
|
int os_utils_directory_writeable(char* path);
|
|
|
|
|
2016-10-27 18:11:34 +00:00
|
|
|
#endif /* utils_h */
|