summaryrefslogtreecommitdiffstats
path: root/src/platform
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2020-04-20 21:51:58 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2020-04-20 21:52:07 +0200
commit4ded6e352ee0fb5d96d2e1b9f051aac1f07b4886 (patch)
tree8d29721809a690acbbaa2efb56402f55eb6436c1 /src/platform
parentd42414b65cdb0156a5a2064a08c894c19370d7a7 (diff)
downloadcc4group-4ded6e352ee0fb5d96d2e1b9f051aac1f07b4886.tar.gz
cc4group-4ded6e352ee0fb5d96d2e1b9f051aac1f07b4886.zip
Rework group saving
save / saveParent write back to the original group saveParent saves changes in child groups (openAsChild) by saving the top-most parent saveAs / saveAsOverwrite resembles the old save / saveOverwrite For all other saving methods, groups opend with openAsChild are saved as if there was no parent
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/platform.h7
-rw-r--r--src/platform/unix.c5
-rw-r--r--src/platform/windows.c6
3 files changed, 17 insertions, 1 deletions
diff --git a/src/platform/platform.h b/src/platform/platform.h
index 688d851..55ed242 100644
--- a/src/platform/platform.h
+++ b/src/platform/platform.h
@@ -24,7 +24,11 @@
#define cc4group_mkdir(path, mode) mkdir((path))
#define SET_BINARY(fd) setmode(fd, O_BINARY)
#else
+ #ifndef _XOPEN_SOURCE
+ #define _XOPEN_SOURCE 700
+ #endif
#include <sys/mman.h>
+ #include <stdlib.h>
#define cc4group_mkdir(path, mode) mkdir((path), (mode))
#define O_BINARY 0
@@ -32,4 +36,5 @@
#endif
void *cc4group_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
-int cc4group_munmap(void *addr, size_t length); \ No newline at end of file
+int cc4group_munmap(void *addr, size_t length);
+char* cc4group_absolutePath(const char* path); \ No newline at end of file
diff --git a/src/platform/unix.c b/src/platform/unix.c
index 9bd8f57..01161fc 100644
--- a/src/platform/unix.c
+++ b/src/platform/unix.c
@@ -9,3 +9,8 @@ int cc4group_munmap(void *addr, size_t length)
{
return munmap(addr, length);
}
+
+char* cc4group_absolutePath(const char* path)
+{
+ return realpath(path, NULL);
+}
diff --git a/src/platform/windows.c b/src/platform/windows.c
index 53d5038..96678ab 100644
--- a/src/platform/windows.c
+++ b/src/platform/windows.c
@@ -97,5 +97,11 @@ int cc4group_munmap(void *addr, size_t length)
return 0;
}
+char* cc4group_absolutePath(const char* path)
+{
+ return _fullpath(NULL, path, 0);
+}
+
+
#undef DWORD_HI
#undef DWORD_LO