From 3c9268353c943b32ca517945c42dfb8c0b8484f8 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 26 Nov 2017 17:33:39 -0800 Subject: Sort directory listing in Nuklear UI file browser --HG-- branch : nuklear_ui --- util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index a426edb..c8a68eb 100644 --- a/util.h +++ b/util.h @@ -62,6 +62,8 @@ char *read_bundled_file(char *name, uint32_t *sizeret); dir_entry *get_dir_list(char *path, size_t *numret); //Frees a dir list returned by get_dir_list void free_dir_list(dir_entry *list, size_t numentries); +//Performs a case-insensitive sort by file name on a dir list +void sort_dir_list(dir_entry *list, size_t num_entries); //Gets the modification time of a file time_t get_modification_time(char *path); //Recusrively creates a directory if it does not exist -- cgit v1.2.3 From c9b253c58788376865cc8768ba342a67b4758bcf Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 26 Nov 2017 18:33:36 -0800 Subject: Filter file list in Nuklear UI --HG-- branch : nuklear_ui --- util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index c8a68eb..516aba3 100644 --- a/util.h +++ b/util.h @@ -42,6 +42,8 @@ char is_absolute_path(char *path); char * basename_no_extension(char *path); //Returns the extension from a path or NULL if there is no extension char *path_extension(char *path); +//Returns true if the given path matches one of the extensions in the list +uint8_t path_matches_extensions(char *path, char **ext_list, uint32_t num_exts); //Returns the directory portion of a path or NULL if there is no directory part char *path_dirname(char *path); //Gets the smallest power of two that is >= a certain value, won't work for values > 0x80000000 -- cgit v1.2.3 From 60e74d48cd8c59f412128d98908f2b04b2b07586 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 6 Feb 2018 22:44:11 -0800 Subject: Fix const correctness for path_extension --HG-- branch : nuklear_ui --- util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util.h') diff --git a/util.h b/util.h index 516aba3..01c360b 100644 --- a/util.h +++ b/util.h @@ -41,7 +41,7 @@ char is_absolute_path(char *path); //Returns the basename of a path with th extension (if any) stripped char * basename_no_extension(char *path); //Returns the extension from a path or NULL if there is no extension -char *path_extension(char *path); +char *path_extension(char const *path); //Returns true if the given path matches one of the extensions in the list uint8_t path_matches_extensions(char *path, char **ext_list, uint32_t num_exts); //Returns the directory portion of a path or NULL if there is no directory part -- cgit v1.2.3 From d738c30dec8a7c9f351094851c00a4623f339084 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 6 Mar 2018 21:27:12 -0800 Subject: Added support for TTC and dfont format true type fonts. More robust font selection on Windows --HG-- branch : nuklear_ui --- util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util.h') diff --git a/util.h b/util.h index 01c360b..53e9929 100644 --- a/util.h +++ b/util.h @@ -34,6 +34,8 @@ char * strip_ws(char * text); char * split_keyval(char * text); //Takes a binary byte buffer and produces a lowercase hex string void bin_to_hex(uint8_t *output, uint8_t *input, uint64_t size); +//Takes an (optionally) null-terminated UTF16-BE string and converts a maximum of max_size code-units to UTF-8 +char *utf16be_to_utf8(uint8_t *buf, uint32_t max_size); //Determines whether a character is a valid path separator for the current platform char is_path_sep(char c); //Determines whether a path is considered an absolute path on the current platform -- cgit v1.2.3 From b6feecb6c12566e9ea826cb67701008f9e423eea Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 25 Mar 2018 12:00:29 -0700 Subject: Make sure config directory exists before trying to save config file --HG-- branch : nuklear_ui --- util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util.h') diff --git a/util.h b/util.h index 53e9929..c846ac5 100644 --- a/util.h +++ b/util.h @@ -71,7 +71,7 @@ void sort_dir_list(dir_entry *list, size_t num_entries); //Gets the modification time of a file time_t get_modification_time(char *path); //Recusrively creates a directory if it does not exist -int ensure_dir_exists(char *path); +int ensure_dir_exists(const char *path); //Returns the contents of a symlink in a newly allocated string char * readlink_alloc(char * path); //Prints an error message to stderr and to a message box if not in headless mode and then exits -- cgit v1.2.3