aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2022-11-29 23:32:10 -0500
committerAdam Harrison <adamdharrison@gmail.com>2022-11-29 23:32:10 -0500
commite038c8cc6818dab3f8ccd4d78ae8797d591cc13f (patch)
treee065f07034c112edd1cdf4dd814259f773cd8c83
parent2516b4c8ba540df06d6d325872c860bb705a387b (diff)
downloadlite-xl-plugin-manager-e038c8cc6818dab3f8ccd4d78ae8797d591cc13f.tar.gz
lite-xl-plugin-manager-e038c8cc6818dab3f8ccd4d78ae8797d591cc13f.zip
Added in preprocessor guard.
-rw-r--r--README.md2
-rwxr-xr-xbuild.sh2
-rw-r--r--src/lpm.c6
3 files changed, 7 insertions, 3 deletions
diff --git a/README.md b/README.md
index 1c099de..7a81837 100644
--- a/README.md
+++ b/README.md
@@ -86,7 +86,7 @@ lpm --help
### Linux to Windows
```
-CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar WINDRES=x86_64-w64-mingw32-windres CMAKE_DEFAULT_FLAGS="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_INCLUDE_PATH=/usr/share/mingw-w64/include" TAR_CONFIGURE="--host=x86_64-w64-mingw32" GIT2_CONFIGURE="-DDLLTOOL=x86_64-w64-mingw32-dlltool" ./build.sh -DLPM_VERSION='"'$VERSION-x86_64-windows-`git rev-parse --short HEAD`'"'
+CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar WINDRES=x86_64-w64-mingw32-windres CMAKE_DEFAULT_FLAGS="-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_INCLUDE_PATH=/usr/share/mingw-w64/include" GIT2_CONFIGURE="-DDLLTOOL=x86_64-w64-mingw32-dlltool" ./build.sh -DLPM_VERSION='"'$VERSION-x86_64-windows-`git rev-parse --short HEAD`'"'
```
diff --git a/build.sh b/build.sh
index 31b5dce..9bdd417 100755
--- a/build.sh
+++ b/build.sh
@@ -9,7 +9,7 @@ SRCS="src/*.c"
CFLAGS="$CFLAGS -Ilib/prefix/include"
LDFLAGS="$LDFLAGS -lm -pthread -static-libgcc -Llib/prefix/lib"
-[[ "$@" == "clean" ]] && rm -rf lib/libgit2/build lib/zlib/build lib/libtar/build lib/mbedtls-2.27.0/build lib/libarchive/build-tmp lib/libzip/build lib/prefix lua $BIN *.exe src/lpm.luac src/lpm.lua.c && exit 0
+[[ "$@" == "clean" ]] && rm -rf lib/libgit2/build lib/zlib/build lib/libzip/build lib/mbedtls-2.27.0/build lib/prefix lua $BIN *.exe src/lpm.luac src/lpm.lua.c && exit 0
# Build supporting libraries, libz, libmbedtls, libmbedcrypto, libgit2, liblzma, libarchive, liblua
CMAKE_DEFAULT_FLAGS=" $CMAKE_DEFAULT_FLAGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=`pwd`/lib/prefix -DCMAKE_INSTALL_PREFIX=`pwd`/lib/prefix -DBUILD_SHARED_LIBS=OFF"
diff --git a/src/lpm.c b/src/lpm.c
index 5b5eb1c..3e0021e 100644
--- a/src/lpm.c
+++ b/src/lpm.c
@@ -440,7 +440,11 @@ static int mkdirp(char* path, int len) {
for (int i = 0; i < len; ++i) {
if (path[i] == '/') {
path[i] = 0;
- if (mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) && errno != EEXIST)
+ #ifndef _WIN32
+ if (mkdir(path, S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) && errno != EEXIST)
+ #else
+ if (mkdir(path) && errno != EEXIST)
+ #endif
return -1;
path[i] = '/';
}