9 May
2019
9 May
'19
2:41 a.m.
On 9/05/2019 00:58, Rainer Deyke wrote:
Don't use argv[0] on Windows, and generally don't use argv for path arguments on Windows. Any Windows program that uses argv[0] for any purpose other than diagnostic output is incorrect.
You can use argv for path arguments, but only if you're using wmain or wWinMain entry points and using the wchar overloads of Filesystem. main or WinMain entry points receive ANSI-codepage arguments, which are guaranteed to not be UTF-8 and are never safe to use as filesystem paths.
argv[0] is broken on Windows. Do not use it.
argv[0] is broken everywhere; it can be set fairly arbitrarily by whoever launches the process, on all platforms.