11#! /bin/bash
22
3+ # Exit immediately if a command exits with a non-zero status.
4+ set -ex
5+
36# Define the source directory for the resources
47SOURCE_DIR=" resources"
58
@@ -9,23 +12,34 @@ DEST_DIR="vscode"
912# Define paths for each file relative to the base directories
1013# Format: "source_file_path:destination_file_path"
1114FILES_TO_COPY=(
12- " favicon.ico:src/sagemaker-code-editor/vscode/ resources/server/favicon.ico"
13- " code-icon.svg:src/sagemaker-code-editor/vscode/src/ vs/workbench/browser/media/code-icon.svg"
14- " letterpress-dark.svg:src/sagemaker-code-editor/vscode/src/ vs/workbench/browser/parts/editor/media/letterpress-dark.svg"
15- " letterpress-hcDark.svg:src/sagemaker-code-editor/vscode/src/ vs/workbench/browser/parts/editor/media/letterpress-hcDark.svg"
16- " letterpress-hcLight.svg:src/sagemaker-code-editor/vscode/src/ vs/workbench/browser/parts/editor/media/letterpress-hcLight.svg"
17- " letterpress-light.svg:src/sagemaker-code-editor/vscode/src/ vs/workbench/browser/parts/editor/media/letterpress-light.svg"
15+ " favicon.ico:resources/server/favicon.ico"
16+ " code-icon.svg:src/vs/workbench/browser/media/code-icon.svg"
17+ " letterpress-dark.svg:src/vs/workbench/browser/parts/editor/media/letterpress-dark.svg"
18+ " letterpress-hcDark.svg:src/vs/workbench/browser/parts/editor/media/letterpress-hcDark.svg"
19+ " letterpress-hcLight.svg:src/vs/workbench/browser/parts/editor/media/letterpress-hcLight.svg"
20+ " letterpress-light.svg:src/vs/workbench/browser/parts/editor/media/letterpress-light.svg"
1821)
1922
20- # Loop through the file paths and copy each one to its new location
23+ # Loop through the file paths, check if file exists, and copy each one to its new location
2124for FILE_PATH in " ${FILES_TO_COPY[@]} " ; do
2225 IFS=" :" read -r SRC_FILE DEST_FILE <<< " $FILE_PATH"
2326
2427 # Construct full source and destination paths
2528 FULL_SRC_PATH=" $SOURCE_DIR /$SRC_FILE "
2629 FULL_DEST_PATH=" $DEST_DIR /$DEST_FILE "
2730
31+ # Check if the source file exists
32+ if [ ! -f " $FULL_SRC_PATH " ]; then
33+ echo " Error: Source file $FULL_SRC_PATH does not exist." >&2
34+ exit 1
35+ fi
36+
37+ # Check if the destination file exists. If so, delete it before copying.
38+ if [ -f " $FULL_DEST_PATH " ]; then
39+ rm " $FULL_DEST_PATH "
40+ echo " Existing file $FULL_DEST_PATH deleted."
41+ fi
42+
2843 # Copy file from source to destination
29- cp " $FULL_SRC_PATH " " $FULL_DEST_PATH "
30- echo " Copied $FULL_SRC_PATH to $FULL_DEST_PATH "
44+ cp -v " $FULL_SRC_PATH " " $FULL_DEST_PATH "
3145done
0 commit comments