stack_wallet/scripts/app_config/shared/link_assets.sh

33 lines
919 B
Bash
Raw Normal View History

2024-05-21 21:40:10 +00:00
#!/usr/bin/env bash
set -x -e
2024-05-28 15:56:40 +00:00
if [ $# -ne 2 ]; then
echo "Usage: $0 <theme specific assets dir name (ex. stack_wallet)> <platform (ex. windows)>"
2024-05-21 21:40:10 +00:00
exit 1
fi
SELECT_ASSETS_DIR=$1
2024-05-28 15:56:40 +00:00
APP_BUILD_PLATFORM=$2
2024-05-21 21:40:10 +00:00
# declare full paths
2024-05-22 00:21:27 +00:00
ASSET_SOURCES_DIR="${APP_PROJECT_ROOT_DIR}/asset_sources"
ASSETS_DIR="${APP_PROJECT_ROOT_DIR}/assets"
2024-05-21 21:40:10 +00:00
# finally update symlinks
2024-06-06 19:40:41 +00:00
for dirname in "default_themes" "icon" "lottie" "in_app_logo_icons" "svg"; do
2024-05-28 15:56:40 +00:00
LINK_SOURCE_DIR="${ASSET_SOURCES_DIR}/${dirname}/${SELECT_ASSETS_DIR}"
2024-05-21 21:40:10 +00:00
2024-05-28 15:56:40 +00:00
rm -f "${ASSETS_DIR}/${dirname}"
2024-05-21 21:40:10 +00:00
2024-05-28 15:56:40 +00:00
if [[ "${APP_BUILD_PLATFORM}" = 'windows' ]]; then
LINK_SOURCE_DIR_WIN_PATH_VERSION=$(wslpath -w "${LINK_SOURCE_DIR}")
LINK_NAME_WIN_PATH_VERSION=$(wslpath -w "${ASSETS_DIR}")
cmd.exe /c mklink /D "${LINK_NAME_WIN_PATH_VERSION}\\${dirname}" "${LINK_SOURCE_DIR_WIN_PATH_VERSION}"
else
ln -s "${LINK_SOURCE_DIR}" "${ASSETS_DIR}/${dirname}"
fi
done