File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 43
43
!define RemoveRegistryGroupWithSingleKey ` !insertmacro _RemoveRegistryGroupWithSingleKey`
44
44
45
45
46
+ ; ----------------------------------------
47
+ ; Removes a directory if there is only one child directory with a particular name present.
48
+ ; IN PARENT_DIR: Path to the parent directory
49
+ ; IN DIRNAME: Name of the child directory to check against
50
+ ; ----------------------------------------
51
+ !macro _RmDirWithSingleChildDir PARENT_DIR DIRNAME
52
+ Push $0
53
+ Push $1
54
+ FindFirst $0 $1 " ${PARENT_DIR}\*"
55
+ StrCmp $1 " " +4 ; [Delete] Either empty or it only contains our file
56
+ StrCmp $1 " ." +5 ; [Next] Current directory
57
+ StrCmp $1 " .." +4 ; [Next] Parent directory
58
+ StrCmp $1 " ${DIRNAME}" +3 +5 ; [Next] If matching, [Break] otherwise
59
+ RmDir /r " ${PARENT_DIR}"
60
+ Goto +3 ; [Break]
61
+ FindNext $0 $1
62
+ Goto -7 ; [Continue]
63
+ FindClose $0
64
+ Pop $1
65
+ Pop $0
66
+ !macroend
67
+ !define RmDirWithSingleChildDir ` !insertmacro _RmDirWithSingleChildDir`
68
+
69
+
46
70
; ----------------------------------------
47
71
; In: FILENAME = filename
48
72
; Out: MAJOR.MINOR.RELEASE.BUILD
Original file line number Diff line number Diff line change @@ -1136,7 +1136,8 @@ Section Uninstall
1136
1136
Delete " $INSTDIR\MTA\*.bin"
1137
1137
1138
1138
RmDir /r " $APPDATA\MTA San Andreas All\${0.0}"
1139
- ; TODO if $APPDATA\MTA San Andreas All\Common is the only one left, delete it
1139
+ ; Delete "$APPDATA\MTA San Andreas All" if "Common" is the only directory in it.
1140
+ ${RmDirWithSingleChildDir} " $APPDATA\MTA San Andreas All" " Common"
1140
1141
1141
1142
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} " ${PRODUCT_UNINST_KEY}"
1142
1143
DeleteRegKey HKLM " ${PRODUCT_DIR_REGKEY}"
You can’t perform that action at this time.
0 commit comments