notepad: Only append .txt to missing files without a dot in them

Alexandre Julliard julliard at winehq.org
Fri Sep 5 09:04:54 CDT 2008


Alexander Nicolaysen Sørnes <alex at thehandofagony.com> writes:

> @@ -590,7 +591,8 @@ static void HandleCommandLine(LPWSTR cmdline)
>              static const WCHAR txtW[] = { '.','t','x','t',0 };
>  
>              /* try to find file with ".txt" extension */
> -            if (!lstrcmp(txtW, cmdline + lstrlen(cmdline) - lstrlen(txtW)))
> +            if (!lstrcmp(txtW, cmdline + lstrlen(cmdline) - lstrlen(txtW)) ||
> +                strchrW(cmdline, '.'))

There's no point in checking for .txt if any extension will match
anyway. Also you should most likely check for a dot only in the
filename, not in the whole path.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list