Add platform specific conditions

This commit is contained in:
code liturgy 2022-11-06 12:50:22 -05:00
parent cf74f616dc
commit 492b37747d
2 changed files with 21 additions and 5 deletions

View File

@ -1,9 +1,22 @@
using Sharp.Augeas;
using System.Runtime.InteropServices;
using Sharp.Augeas;
using Sharp.Augeas.Test;
var path = Environment.CurrentDirectory;
var root = $"{path}/root/";
AugSettings augSettings = new AugSettings(root, "/opt/homebrew/share/augeas/lenses/dist");
var lensPath = "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
lensPath = "/usr/share/augeas/lenses/dist";
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
lensPath = "/opt/homebrew/share/augeas/lenses/dist";
}
AugSettings augSettings = new AugSettings(root, lensPath);
var augeas = new Augeas(augSettings);
// Calling extern functions

View File

@ -1,6 +1,9 @@
#!/bin/bash
LIB_FILE=libclAugeas.dylib
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
LIB_FILE=libclAugeas.so
elif [[ "$OSTYPE" == "darwin"* ]]; then
LIB_FILE=libclAugeas.dylib
fi
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
DESTIN=$SCRIPT_DIR/bin/Debug/net6.0
@ -9,7 +12,7 @@ DESTIN=$SCRIPT_DIR/bin/Debug/net6.0
if [[ -z "${CLAUG_LIB_PATH}" ]]; then
echo "error: set the CLAUG_LIB_PATH in the ${LIB_FILE} location."
echo
return
exit 2
fi
BINARY=$CLAUG_LIB_PATH/$LIB_FILE