Fixed linking procedure for old ln versions

This commit is contained in:
WolverinDEV 2019-07-03 14:29:44 +02:00
parent 5733a250b0
commit 90b0cd97b8

View File

@ -5,8 +5,8 @@ cd "${BASEDIR}"
file_paths=(
"$(pwd ~)/../../Web-Client/shared/declarations"
# "$(pwd ~)/TeaSpeak/Web-Client/shared/declarations"
# "$(pwd ~)/../../TeaSpeak/Web-Client/shared/declarations"
"$(pwd ~)/TeaSpeak/Web-Client/shared/declarations"
"$(pwd ~)/../../TeaSpeak/Web-Client/shared/declarations"
"app/dummy-declarations"
#TODO Windows path
)
@ -15,8 +15,10 @@ files=(
# "exports_loader.d.ts;imports_shared_loader.d.ts"
)
support_rel_linking=$(ln --help 2>&1 | grep -e "--relative" >/dev/null && echo "1" || echo "0")
support_rel_linking=0
path_target="./modules/renderer/imports"
path_found=0
{
mkdir -p "${path_target}"
@ -46,7 +48,20 @@ path_found=0
rm "${path_target}/${dst_file}"
fi
if [[ ${support_rel_linking} -ne 0 ]]; then
ln -rs "${path}/${src_file}" "${path_target}/${dst_file}"
else
_source=$(realpath "${path}/${src_file}")
_current_dir=$(pwd)
cd ${path_target}
[[ $? -ne 0 ]] && {
echo "Failed to enter target directory"
exit 1;
}
ln -s "${_source}" "${dst_file}"
cd ${_current_dir}
fi
echo "Linking \"${path_target}/${dst_file}\" to \"${path}/${src_file}\""
cp "${path}/${src_file}" "${path_target}/copy_${dst_file}"
@ -74,7 +89,19 @@ if [[ ${path_found} -eq 0 ]]; then
exit 1
fi
if [[ ${support_rel_linking} -ne 0 ]]; then
ln -rs "${path_target}/copy_${dst_file}" "${path_target}/${dst_file}"
else
_source=$(realpath "${path_target}/copy_${dst_file}")
_current_dir=$(pwd)
cd ${path_target}
[[ $? -ne 0 ]] && {
echo "Failed to enter target directory"
exit 1;
}
ln -s "${_source}" "${dst_file}"
cd ${_current_dir}
fi
echo "Linking \"${path_target}/${dst_file}\" to \"${path_target}/copy_${dst_file}\""
done
path_found=1