== Steps to reproduce: ==
- Create a wrapper with special chars in its path (for a 100% reproducible issue, just use a [string in square brackets] wherever in the wrapper's name or in its parent folders)
- Create a Custom EXE launcher pointing to your favorite windows executable within the wrapper (i.e. /Windows/notepad.exe)
- Launch the Custom EXE
== Expected results: ==
- The custom exe launcher should launch whatever executable you set
== Actual results: ==
- Nothing happens. An unhandled exception is thrown, as shown in the Console log:
2012-04-10 3:58:29.282 am Wineskin: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSCFString substringToIndex:]: Range or index out of bounds'
*** Call stack at first throw:
0 CoreFoundation 0x92835b67 __raiseError + 231
1 libobjc.A.dylib 0x98d70149 objc_exception_throw + 155
2 CoreFoundation 0x9279d369 +[NSException raise:format:arguments:] + 137
3 CoreFoundation 0x9279d2d9 +[NSException raise:format:] + 57
4 Foundation 0x9c4ed134 -[NSString substringToIndex:] + 106
5 Wineskin 0x00003657 -[Wineskin mainRun:] + 4439
6 Wineskin 0x000125b9 main + 313
7 Wineskin 0x000024b5 start + 53
8 ??? 0x00000003 0x0 + 3
== Issue analysis: ==
After an analysis, the cause has been traced down to the following line in CustomEXE:
When special characters are contained in the wrapper's path, the search string on the right side of the hash sign contains special characters, which are handled as such by the shell.
The solution I suggest involves using the 'basename' utility rather than the shell's string manipulation routines. See the attached patch.