comparison util.h @ 957:1618d3676a35

Save state menu WIP
author Michael Pavone <pavone@retrodev.com>
date Fri, 15 Apr 2016 23:57:50 -0700
parents 229c23b3ab73
children 51885857c019
comparison
equal deleted inserted replaced
956:f5550cdffe49 957:1618d3676a35
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 #include <time.h>
5 6
6 typedef struct { 7 typedef struct {
7 char *name; 8 char *name;
8 uint8_t is_dir; 9 uint8_t is_dir;
9 } dir_entry; 10 } dir_entry;
38 char *read_bundled_file(char *name, long *sizeret); 39 char *read_bundled_file(char *name, long *sizeret);
39 //Retunrs an array of normal files and directories residing in a directory 40 //Retunrs an array of normal files and directories residing in a directory
40 dir_entry *get_dir_list(char *path, size_t *numret); 41 dir_entry *get_dir_list(char *path, size_t *numret);
41 //Frees a dir list returned by get_dir_list 42 //Frees a dir list returned by get_dir_list
42 void free_dir_list(dir_entry *list, size_t numentries); 43 void free_dir_list(dir_entry *list, size_t numentries);
44 //Gets the modification time of a file
45 time_t get_modification_time(char *path);
43 //Recusrively creates a directory if it does not exist 46 //Recusrively creates a directory if it does not exist
44 int ensure_dir_exists(char *path); 47 int ensure_dir_exists(char *path);
45 //Returns the contents of a symlink in a newly allocated string 48 //Returns the contents of a symlink in a newly allocated string
46 char * readlink_alloc(char * path); 49 char * readlink_alloc(char * path);
47 //Prints an error message to stderr and to a message box if not in headless mode and then exits 50 //Prints an error message to stderr and to a message box if not in headless mode and then exits