Skip to content

Commit

Permalink
fix: Compatibility issues with osx and unix platforms around the sed (#…
Browse files Browse the repository at this point in the history
…217)

Signed-off-by: Francisco Javier Ribó Labrador <elribonazo@gmail.com>
  • Loading branch information
elribonazo committed May 17, 2024
1 parent 55ee8b1 commit 47ec1c8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions externals/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ anoncredsNewCommit=$(git submodule | grep $AnonCreds | awk '{print $1}')
anoncredsOldCommit=$(cat "${ExternalsDir}/${AnonCreds}.commit" 2>/dev/null)
anoncredsRequired=$?

is_mac() {
[[ "$OSTYPE" == "darwin"* ]]
}

buildDIDComm() {
echo "Build DIDComm"
Expand All @@ -39,7 +42,11 @@ buildDIDComm() {
#This code fails on browser when wasm is first loaded, it can just be ignored
#The code will fully work
cd "${GenDIDComm}-wasm-browser"
sed -i '' "/if (typeof input === 'undefined') {/,/}/d" didcomm_js.js
if is_mac; then
sed -i '' "/if (typeof input === 'undefined') {/,/}/d" didcomm_js.js
else
sed -i "/if (typeof input === 'undefined') {/,/}/d" didcomm_js.js
fi

cd $ExternalsDir
git submodule | grep $DIDComm | awk '{print $1}' > "./${DIDComm}.commit"
Expand All @@ -64,8 +71,11 @@ buildAnonCreds() {
#This code fails on browser when wasm is first loaded, it can just be ignored
#The code will fully work
cd "${GenAnonCreds}-wasm-browser"
sed -i '' "/if (typeof input === 'undefined') {/,/}/d" "./${AnonCreds}.js"

if is_mac; then
sed -i '' "/if (typeof input === 'undefined') {/,/}/d" "./${AnonCreds}.js"
else
sed -i "/if (typeof input === 'undefined') {/,/}/d" "./${AnonCreds}.js"
fi
cd $ExternalsDir
git submodule | grep $AnonCreds | awk '{print $1}' > "./${AnonCreds}.commit"
}
Expand Down

0 comments on commit 47ec1c8

Please sign in to comment.