Add platform specific conditions
This commit is contained in:
parent
cf74f616dc
commit
492b37747d
|
@ -1,9 +1,22 @@
|
||||||
using Sharp.Augeas;
|
using System.Runtime.InteropServices;
|
||||||
|
using Sharp.Augeas;
|
||||||
using Sharp.Augeas.Test;
|
using Sharp.Augeas.Test;
|
||||||
|
|
||||||
var path = Environment.CurrentDirectory;
|
var path = Environment.CurrentDirectory;
|
||||||
var root = $"{path}/root/";
|
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);
|
var augeas = new Augeas(augSettings);
|
||||||
// Calling extern functions
|
// Calling extern functions
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
LIB_FILE=libclAugeas.dylib
|
LIB_FILE=libclAugeas.so
|
||||||
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
LIB_FILE=libclAugeas.dylib
|
||||||
|
fi
|
||||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
DESTIN=$SCRIPT_DIR/bin/Debug/net6.0
|
DESTIN=$SCRIPT_DIR/bin/Debug/net6.0
|
||||||
|
|
||||||
|
@ -9,7 +12,7 @@ DESTIN=$SCRIPT_DIR/bin/Debug/net6.0
|
||||||
if [[ -z "${CLAUG_LIB_PATH}" ]]; then
|
if [[ -z "${CLAUG_LIB_PATH}" ]]; then
|
||||||
echo "error: set the CLAUG_LIB_PATH in the ${LIB_FILE} location."
|
echo "error: set the CLAUG_LIB_PATH in the ${LIB_FILE} location."
|
||||||
echo
|
echo
|
||||||
return
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BINARY=$CLAUG_LIB_PATH/$LIB_FILE
|
BINARY=$CLAUG_LIB_PATH/$LIB_FILE
|
||||||
|
|
Loading…
Reference in New Issue