Mercurial > repos > blastem
comparison util.h @ 866:69a6ec208111
Menu ROM now pulls real file names from the OS rather than using a fake list
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 06 Nov 2015 12:19:39 -0800 |
parents | 792be135d3af |
children | 54ffba3768d6 |
comparison
equal
deleted
inserted
replaced
865:305c85c0b954 | 866:69a6ec208111 |
---|---|
1 #ifndef UTIL_H_ | 1 #ifndef UTIL_H_ |
2 #define UTIL_H_ | 2 #define UTIL_H_ |
3 | 3 |
4 #include <stdio.h> | 4 #include <stdio.h> |
5 | |
6 typedef struct { | |
7 char *name; | |
8 uint8_t is_dir; | |
9 } dir_entry; | |
5 | 10 |
6 //Utility functions | 11 //Utility functions |
7 | 12 |
8 //Allocates a new string containing the concatenation of first and second | 13 //Allocates a new string containing the concatenation of first and second |
9 char * alloc_concat(char * first, char * second); | 14 char * alloc_concat(char * first, char * second); |
21 void set_exe_str(char * str); | 26 void set_exe_str(char * str); |
22 //Returns the directory the executable is in | 27 //Returns the directory the executable is in |
23 char * get_exe_dir(); | 28 char * get_exe_dir(); |
24 //Returns the user's home directory | 29 //Returns the user's home directory |
25 char * get_home_dir(); | 30 char * get_home_dir(); |
31 //Retunrs an array of normal files and directories residing in a directory | |
32 dir_entry *get_dir_list(char *path, size_t *numret); | |
33 //Frees a dir list returned by get_dir_list | |
34 void free_dir_list(dir_entry *list, size_t numentries); | |
26 //Returns the contents of a symlink in a newly allocated string | 35 //Returns the contents of a symlink in a newly allocated string |
27 char * readlink_alloc(char * path); | 36 char * readlink_alloc(char * path); |
28 //Prints an error message to stderr and to a message box if not in headless mode and then exits | 37 //Prints an error message to stderr and to a message box if not in headless mode and then exits |
29 void fatal_error(char *format, ...); | 38 void fatal_error(char *format, ...); |
30 //Prints an information message to stdout and to a message box if not in headless mode and not attached to a console | 39 //Prints an information message to stdout and to a message box if not in headless mode and not attached to a console |