Misc: Allow directories with spaces in extractor.sh (#31648)

(cherry picked from commit 607108db282a2d538ad59a67586b2b074fd9ec70)
Signed-off-by: luis <[email protected]>
This commit is contained in:
FlyingRatBull
2026-06-30 19:09:26 -03:00
committed by luis
parent 8c8d816d08
commit 29658de146
+26 -26
View File
@@ -2,39 +2,39 @@
# Set client and server directories as environment variables # Set client and server directories as environment variables
# if you don't want to enter them here # if you don't want to enter them here
if [ -z $CLIENT_DIR ]; then if [ -z "$CLIENT_DIR" ]; then
echo -n "Enter directory where client files are located: " echo -n "Enter directory where client files are located: "
read CLIENT_DIR read CLIENT_DIR
if ! cd $CLIENT_DIR; then if ! cd "$CLIENT_DIR"; then
echo "Cannot access $CLIENT_DIR" echo "Cannot access $CLIENT_DIR"
exit 1 exit 1
fi fi
if [ ! -d $CLIENT_DIR/Data ]; then if [ ! -d "$CLIENT_DIR/Data" ]; then
echo "Cannot find client files in $CLIENT_DIR" echo "Cannot find client files in $CLIENT_DIR"
exit 1 exit 1
fi fi
fi fi
if [ -z $SERVER_DIR ]; then if [ -z "$SERVER_DIR" ]; then
echo -n "Enter directory where server files are located: " echo -n "Enter directory where server files are located: "
read SERVER_DIR read SERVER_DIR
if ! cd $SERVER_DIR; then if ! cd "$SERVER_DIR"; then
echo "Cannot access $SERVER_DIR" echo "Cannot access $SERVER_DIR"
exit 1 exit 1
fi fi
fi fi
# These should all be correct on a standard installation # These should all be correct on a standard installation
DATA_DIR=${SERVER_DIR}/data DATA_DIR="${SERVER_DIR}/data"
MAPEXTRACTOR=${SERVER_DIR}/bin/mapextractor MAPEXTRACTOR="${SERVER_DIR}/bin/mapextractor"
VMAP4EXTRACTOR=${SERVER_DIR}/bin/vmap4extractor VMAP4EXTRACTOR="${SERVER_DIR}/bin/vmap4extractor"
VMAP4ASSEMBLER=${SERVER_DIR}/bin/vmap4assembler VMAP4ASSEMBLER="${SERVER_DIR}/bin/vmap4assembler"
MMAPS_GENERATOR=${SERVER_DIR}/bin/mmaps_generator MMAPS_GENERATOR="${SERVER_DIR}/bin/mmaps_generator"
check_files() { check_files() {
for i in $MAPEXTRACTOR $VMAP4EXTRACTOR $VMAP4ASSEMBLER $MMAPS_GENERATOR for i in "$MAPEXTRACTOR" "$VMAP4EXTRACTOR" "$VMAP4ASSEMBLER" "$MMAPS_GENERATOR"
do do
if [[ ! -x $i ]] if [[ ! -x $i ]]
then then
@@ -62,23 +62,23 @@ echo "Extracting DBC, gt, Camera and Maps files"
echo echo
echo "-- Using $MAPEXTRACTOR" echo "-- Using $MAPEXTRACTOR"
echo "-- Copying extracted data to ${DATA_DIR}" echo "-- Copying extracted data to ${DATA_DIR}"
if [[ ! -d ${DATA_DIR} ]] if [[ ! -d "${DATA_DIR}" ]]
then then
echo "-- Creating ${DATA_DIR}" echo "-- Creating ${DATA_DIR}"
mkdir ${DATA_DIR} mkdir "${DATA_DIR}"
fi fi
echo "-- Starting in 5 seconds" echo "-- Starting in 5 seconds"
sleep 5 sleep 5
cd ${CLIENT_DIR} cd "${CLIENT_DIR}"
$MAPEXTRACTOR "$MAPEXTRACTOR"
echo "-- Extraction complete, copying dbc, gt and maps files" echo "-- Extraction complete, copying dbc, gt and maps files"
cp -r dbc gt maps ${DATA_DIR} cp -r dbc gt maps "${DATA_DIR}"
if [[ -d ${CLIENT_DIR}/cameras ]] if [[ -d "${CLIENT_DIR}/cameras" ]]
then then
echo "-- Camera files found, copying" echo "-- Camera files found, copying"
cp -r cameras ${DATA_DIR} cp -r cameras "${DATA_DIR}"
fi fi
echo "-- Done" echo "-- Done"
@@ -95,13 +95,13 @@ echo "-- Copying extracted data to ${DATA_DIR}/vmaps"
echo "-- Starting in 5 seconds" echo "-- Starting in 5 seconds"
sleep 5 sleep 5
cd ${CLIENT_DIR} cd "${CLIENT_DIR}"
$VMAP4EXTRACTOR "$VMAP4EXTRACTOR"
mkdir vmaps mkdir vmaps
$VMAP4ASSEMBLER Buildings vmaps "$VMAP4ASSEMBLER" Buildings vmaps
echo "-- Extraction complete, copying files" echo "-- Extraction complete, copying files"
cp -r vmaps ${DATA_DIR} cp -r vmaps "${DATA_DIR}"
echo "-- Done" echo "-- Done"
echo echo
} }
@@ -115,11 +115,11 @@ echo "-- Copying extracted data to ${DATA_DIR}/mmaps"
echo "-- Starting in 5 seconds" echo "-- Starting in 5 seconds"
sleep 5 sleep 5
cd ${CLIENT_DIR} cd "${CLIENT_DIR}"
mkdir mmaps mkdir mmaps
$MMAPS_GENERATOR "$MMAPS_GENERATOR"
echo "-- Extraction complete, copying files" echo "-- Extraction complete, copying files"
cp -r mmaps ${DATA_DIR} cp -r mmaps "${DATA_DIR}"
echo "-- Done" echo "-- Done"
echo echo
} }
@@ -135,7 +135,7 @@ echo "Enter y to continue or anything else to cancel"
read a read a
if [[ ${a} = "y" ]] if [[ ${a} = "y" ]]
then then
cd ${CLIENT_DIR} cd "${CLIENT_DIR}"
rm -fr Buildings cameras dbc gt maps mmaps vmaps rm -fr Buildings cameras dbc gt maps mmaps vmaps
echo "Done" echo "Done"
fi fi