62 lines
1.6 KiB
Bash
Executable File
62 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
BASEDIR=$(dirname "$0")
|
|
cd "${BASEDIR}"
|
|
|
|
file_paths=(
|
|
"$(pwd ~)/../../Web-Client/shared/declarations"
|
|
"$(pwd ~)/TeaSpeak/Web-Client/shared/declarations"
|
|
"$(pwd ~)/../../TeaSpeak/Web-Client/shared/declarations"
|
|
"app/dummy-declarations"
|
|
#TODO Windows path
|
|
)
|
|
files=(
|
|
"exports.d.ts;imports_shared.d.ts"
|
|
# "exports_loader.d.ts;imports_shared_loader.d.ts"
|
|
)
|
|
|
|
path_target="./modules/renderer/imports"
|
|
path_found=0
|
|
{
|
|
mkdir -p "${path_target}"
|
|
|
|
for path in "${file_paths[@]}"
|
|
do
|
|
path_found=1
|
|
for file_mapping in "${files[@]}"
|
|
do
|
|
file_mapping=($(echo ${file_mapping} | tr ";" " "))
|
|
file=${file_mapping[0]}
|
|
|
|
if [[ ! -f "${path}/${file}" ]]; then
|
|
path_found=0
|
|
echo "path test ${path} failed to file ${file}"
|
|
break
|
|
fi
|
|
done
|
|
[[ path_found -eq 1 ]] || continue
|
|
|
|
for file in "${files[@]}"
|
|
do
|
|
file_mapping=$(echo ${file_mapping} | tr ";" "\n")
|
|
src_file=${file_mapping[0]}
|
|
dst_file=${file_mapping[1]}
|
|
|
|
if [[ -e "${path_target}/${dst_file}" ]] || [[ -L "${path_target}/${dst_file}" ]]; then
|
|
rm "${path_target}/${dst_file}"
|
|
fi
|
|
|
|
ln -rs "${path}/${src_file}" "${path_target}/${dst_file}"
|
|
echo "Linking \"${path_target}/${dst_file}\" to \"${path}/${src_file}\""
|
|
done
|
|
break
|
|
done
|
|
}
|
|
|
|
if [[ path_found -eq 0 ]]; then
|
|
echo "Failed to find UI imports"
|
|
echo "Add your path to 'file_paths' and build the declarations first"
|
|
exit 1
|
|
fi
|
|
|
|
exit 1 |