comparison util.h @ 1140:4490c9c12272

Detect system type from filename if header based methods fail. Allow overriding system type from command line.
author Michael Pavone <pavone@retrodev.com>
date Mon, 02 Jan 2017 21:46:26 -0800
parents 22e87b739ad6
children 5905593d6828
comparison
equal deleted inserted replaced
1139:160e3f597cec 1140:4490c9c12272
33 char is_path_sep(char c); 33 char is_path_sep(char c);
34 //Determines whether a path is considered an absolute path on the current platform 34 //Determines whether a path is considered an absolute path on the current platform
35 char is_absolute_path(char *path); 35 char is_absolute_path(char *path);
36 //Returns the basename of a path with th extension (if any) stripped 36 //Returns the basename of a path with th extension (if any) stripped
37 char * basename_no_extension(char *path); 37 char * basename_no_extension(char *path);
38 //Returns the extension from a path or NULL if there is no extension
39 char *path_extension(char *path);
38 //Gets the smallest power of two that is >= a certain value, won't work for values > 0x80000000 40 //Gets the smallest power of two that is >= a certain value, won't work for values > 0x80000000
39 uint32_t nearest_pow2(uint32_t val); 41 uint32_t nearest_pow2(uint32_t val);
40 //Should be called by main with the value of argv[0] for use by get_exe_dir 42 //Should be called by main with the value of argv[0] for use by get_exe_dir
41 void set_exe_str(char * str); 43 void set_exe_str(char * str);
42 //Returns the directory the executable is in 44 //Returns the directory the executable is in
46 //Returns an appropriate path for storing config files 48 //Returns an appropriate path for storing config files
47 char const *get_config_dir(); 49 char const *get_config_dir();
48 //Returns an appropriate path for saving non-config data like savestates 50 //Returns an appropriate path for saving non-config data like savestates
49 char const *get_save_dir(); 51 char const *get_save_dir();
50 //Reads a file bundled with the executable 52 //Reads a file bundled with the executable
51 char *read_bundled_file(char *name, long *sizeret); 53 char *read_bundled_file(char *name, uint32_t *sizeret);
52 //Retunrs an array of normal files and directories residing in a directory 54 //Retunrs an array of normal files and directories residing in a directory
53 dir_entry *get_dir_list(char *path, size_t *numret); 55 dir_entry *get_dir_list(char *path, size_t *numret);
54 //Frees a dir list returned by get_dir_list 56 //Frees a dir list returned by get_dir_list
55 void free_dir_list(dir_entry *list, size_t numentries); 57 void free_dir_list(dir_entry *list, size_t numentries);
56 //Gets the modification time of a file 58 //Gets the modification time of a file