summaryrefslogtreecommitdiffstats
path: root/src/platform/windows.c
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2020-04-21 00:54:38 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2020-04-21 00:54:38 +0200
commit20f8542d2730654ba7140dc59240c8d477476e77 (patch)
tree2c48120a8882e70142fea964906e50f95d08d171 /src/platform/windows.c
parent830ee22b85f1e91c547354435af2b6a79578f7ce (diff)
downloadcc4group-20f8542d2730654ba7140dc59240c8d477476e77.tar.gz
cc4group-20f8542d2730654ba7140dc59240c8d477476e77.zip
Add cc4group.getName and cc4group.getFullName
Diffstat (limited to 'src/platform/windows.c')
-rw-r--r--src/platform/windows.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/platform/windows.c b/src/platform/windows.c
index 96678ab..50cb722 100644
--- a/src/platform/windows.c
+++ b/src/platform/windows.c
@@ -15,6 +15,7 @@
#include <io.h>
#include <windows.h>
+#include <string.h>
#include <sys/types.h>
#include "platform.h"
@@ -90,6 +91,9 @@ void *cc4group_mmap(void *start, size_t length, int prot, int flags, int fd, off
return ret;
}
+#undef DWORD_HI
+#undef DWORD_LO
+
int cc4group_munmap(void *addr, size_t length)
{
(void)length;
@@ -102,6 +106,13 @@ char* cc4group_absolutePath(const char* path)
return _fullpath(NULL, path, 0);
}
-
-#undef DWORD_HI
-#undef DWORD_LO
+char* cc4group_basename(const char* path)
+{
+ char fname[_MAX_FNAME];
+ char ext[_MAX_EXT];
+ _splitpath(path, NULL, NULL, fname, ext);
+ char* result = malloc(sizeof(char) * (strlen(fname) + strlen(ext) + 1);
+ strcpy(result, fname);
+ strcat(result, ext);
+ return result;
+}