-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmiengine-copy.sh
executable file
·75 lines (66 loc) · 2.03 KB
/
miengine-copy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
src='J:/VSCode/MIEngine/bin/Desktop.Debug'
mycp=cp
if [[ -d "$src" ]]; then
echo "Using local-dir '$src'"
else
mycp="scp -q"
src="[email protected]:/$src"
echo "Using remote-dir '$src'"
fi
dllExt='dll.mdb'
exeExt='exe.mdb'
if [[ ($OSTYPE == 'cygwin') || ($OSTYPE == 'win32') ]]; then
dllExt='pdb'
exeExt='pdb'
export HOME="${USERPROFILE//\\//}"
fi
# Find latest extension
exthome="$HOME/.vscode/extensions"
extdir=`ls -1rt "$exthome" | grep ms-vscode.cpptools | tail -1`
dst1="$exthome/$extdir/debugAdapters/bin"
dst2="${dst1//.vscode/.vscode-oss-dev}"
dst3="${dst1//.vscode/.vscode-insiders}"
declare -a dsts=("$dst1")
[[ -d "$dst2" ]] && dsts+=("$dst2")
[[ -d "$dst3" ]] && dsts+=("$dst3")
# (IFS=$'\n'; echo "${dsts[*]}")
declare -a files=(
"Microsoft.MICore.dll"
"Microsoft.MICore.XmlSerializers.dll"
"Microsoft.MIDebugEngine.dll"
"vscode/OpenDebugAD7.exe"
"vscode/Microsoft.DebugEngineHost.dll"
"vscode/Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.dll"
"Microsoft.MICore.${dllExt}"
"Microsoft.MIDebugEngine.${dllExt}"
"vscode/OpenDebugAD7.${exeExt}"
"vscode/Microsoft.DebugEngineHost.${dllExt}"
)
for dst in "${dsts[@]}" ; do
if [[ ! -d "$dst" ]]; then
if [[ "$dst" == "$dst1" ]]; then
echo "Destination directory '$dst' does not exist"
exit 1
fi
echo "Skipping destination dir '$dst'"
continue
else
echo "Destination dir '$dst'"
fi
if [[ ! -d "${dst}.bak" ]]; then
echo "Making a backup of '$dst'"
cp -r "$dst" "${dst}.bak"
[[ $? == 0 ]] || { echo Failed to create backup ; exit 1 ; }
else
echo "Note: Backup '${dst}.bak' already exists..."
fi
for f in "${files[@]}" ; do
echo "Copying '$src/$f' ..."
$mycp -p "$src/$f" "$dst"
[[ $? == 0 ]] || { echo "Failed!!!" ; exit 1 ; }
done
echo "Listing of '$dst'"
ls -lrt "$dst"
echo ======================================================================
done