aboutsummaryrefslogtreecommitdiff
path: root/src/path.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/path.cpp')
-rw-r--r--src/path.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/path.cpp b/src/path.cpp
index baae94670..414a90c39 100644
--- a/src/path.cpp
+++ b/src/path.cpp
@@ -1,7 +1,9 @@
/*
Path handling utilities.
*/
+#if !defined(GB_SYSTEM_WINDOWS)
#include<unistd.h>
+#endif
gb_internal String remove_extension_from_path(String const &s) {
if (s.len != 0 && s.text[s.len-1] == '.') {
@@ -27,7 +29,9 @@ gb_internal String remove_directory_from_path(String const &s) {
return substring(s, s.len-len, s.len);
}
+
// NOTE(Mark Naughton): getcwd as String
+#if !defined(GB_SYSTEM_WINDOWS)
gb_internal String get_current_directory(void) {
gbAllocator a = heap_allocator();
@@ -37,6 +41,17 @@ gb_internal String get_current_directory(void) {
return make_string_c(cwd);
}
+#else
+gb_internal String get_current_directory(void) {
+ gbAllocator a = heap_allocator();
+
+ wchar_t cwd[256];
+ GetCurrentDirectoryW(256, cwd);
+
+ return make_string_c(cwd);
+}
+#endif
+
gb_internal bool path_is_directory(String path);
gb_internal String directory_from_path(String const &s) {