u/file: Make more functions work on Windows

This commit is contained in:
Julian Petrov 2022-07-27 13:04:09 -04:00 committed by Jakob Bornecrantz
parent cc2e7b6da3
commit c7a5a0bc1b

View file

@ -15,10 +15,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h>
#ifdef XRT_OS_LINUX #ifdef XRT_OS_LINUX
#include <sys/stat.h>
#include <linux/limits.h> #include <linux/limits.h>
static int static int
@ -104,6 +104,10 @@ u_file_open_file_in_config_dir(const char *filename, const char *mode)
return fopen(file_str, mode); return fopen(file_str, mode);
} }
#else if defined(XRT_OS_WINDOWS)
#define PATH_MAX MAX_PATH
#endif
ssize_t ssize_t
u_file_get_runtime_dir(char *out_path, size_t out_path_size) u_file_get_runtime_dir(char *out_path, size_t out_path_size)
{ {
@ -128,8 +132,6 @@ u_file_get_path_in_runtime_dir(const char *suffix, char *out_path, size_t out_pa
return snprintf(out_path, out_path_size, "%s/%s", tmp, suffix); return snprintf(out_path, out_path_size, "%s/%s", tmp, suffix);
} }
#endif
char * char *
u_file_read_content(FILE *file) u_file_read_content(FILE *file)
{ {