summaryrefslogtreecommitdiff
path: root/src/util/file/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/file/util.c')
-rw-r--r--src/util/file/util.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/util/file/util.c b/src/util/file/util.c
index 2f1fa36..0a42aad 100644
--- a/src/util/file/util.c
+++ b/src/util/file/util.c
@@ -1,5 +1,25 @@
#include "file.h"
+void nn_path_append(str *path, str *part)
+{
+#ifdef NAUNET_ON_WINDOWS
+ al_str_cat(path, &al_str_c("\\"));
+#else
+ al_str_cat(path, &al_str_c("/"));
+#endif
+ al_str_cat(path, part);
+}
+
+void nn_path_prepend(str *path, str *part)
+{
+#ifdef NAUNET_ON_WINDOWS
+ al_str_prepend(path, &al_str_c("\\"));
+#else
+ al_str_prepend(path, &al_str_c("/"));
+#endif
+ al_str_prepend(path, part);
+}
+
s32 nn_file_read_as_str(struct nn_file *file, str *out)
{
size_t size = file->size;
@@ -20,7 +40,7 @@ s32 nn_file_read_as_c_str(struct nn_file *file, char **out)
al_free(*out);
return -1;
}
- c_str[size] = '\n';
+ c_str[size] = '\0';
*out = c_str;
return size;
}