-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwine_debug_dnspy.sh
More file actions
executable file
·37 lines (28 loc) · 1.1 KB
/
Copy pathwine_debug_dnspy.sh
File metadata and controls
executable file
·37 lines (28 loc) · 1.1 KB
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
#!/bin/bash
export WINEPREFIX=$HOME/.wine-dotnet48-64
# $1 might be /home/damir/... or D:\...
INPUT_PATH="$1"
# 1. Normalize paths using winepath to handle mixed slashes (from VS Code)
LINUX_FULL_PATH=$(winepath -u "$INPUT_PATH")
LINUX_EXE_DIR=$(dirname "$LINUX_FULL_PATH")
EXE_PATH=$(winepath -w "$INPUT_PATH")
EXE_NAME=$(basename "$LINUX_FULL_PATH")
# 3. Clear dnSpy session only if target changed
DNSPY_CONFIG_DIR="$WINEPREFIX/drive_c/users/$USER/AppData/Roaming/dnSpy"
LAST_TARGET_FILE="$WINEPREFIX/.wine_debug_dnspy_last_target"
LAST_TARGET=""
if [ -f "$LAST_TARGET_FILE" ]; then
LAST_TARGET=$(cat "$LAST_TARGET_FILE")
fi
if [ "$LINUX_FULL_PATH" != "$LAST_TARGET" ] && [ -d "$DNSPY_CONFIG_DIR" ]; then
find "$DNSPY_CONFIG_DIR" -mindepth 1 -delete
fi
printf '%s\n' "$LINUX_FULL_PATH" > "$LAST_TARGET_FILE"
# 4. Find all gip DLLs
DLL_LIST=$(find "$LINUX_EXE_DIR" -maxdepth 1 -name "gip.*.dll" -exec winepath -w {} +)
# 5. Launch
export DOTNET_ROOT=""
wine "$EXE_PATH" &
sleep 2
DNSPY_BIN="/home/damir/SHARED/Devel/Tools/dnSpy/dnSpy-net-win64/dnSpy.exe"
wine "$DNSPY_BIN" -pn "$EXE_NAME" "$EXE_PATH" $DLL_LIST