Skip to content

Commit

Permalink
working system plugin in macos
Browse files Browse the repository at this point in the history
  • Loading branch information
rvjansen committed Dec 22, 2024
1 parent f42940d commit 2c13098
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ add_subdirectory(rxmath)
add_subdirectory(stack)
add_subdirectory(cipher)
add_subdirectory(rxuuid)
add_subdirectory(system)
if(WIN32)
add_subdirectory(regex)
add_subdirectory(keyaccess)
add_subdirectory(rxtcp)
add_subdirectory(llist)
add_subdirectory(system)
add_subdirectory(fileio)
endif()
17 changes: 16 additions & 1 deletion lib/plugins/system/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include <limits.h>
#if defined(__APPLE__)
#include <sys/stat.h>
#endif
#include <unistd.h> // For POSIX systems (Linux/macOS)
#ifdef _WIN32
#include <direct.h> // For Windows
#include <windows.h>
#define getcwd _getcwd // Map to Windows-specific version
#else
#include <dirent.h>
#include <ctype.h>
#endif
#include "crexxpa.h" // crexx/pa - Plugin Architecture header file
// distinguish between Windows and Linux and MAC
Expand All @@ -29,6 +29,21 @@
#define TEST_DIR(path) access(path, F_OK)
#define TEST_FILE(fname) access(fname, F_OK)
#define RENAME_FILE(source,target) rename(source, target)
#define max(a,b) \
({ \
__typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; \
})

#define min(a,b) \
({ \
__typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; \
})
#endif

#endif

// replace \ chars by / (needed in Windows)
Expand Down

0 comments on commit 2c13098

Please sign in to comment.