[NOTEPAD] Use full path for non-existent file (#5152)

In HandleCommandLine function, use GetFullPathName API to get the full path of a non-existent file. CORE-18259, CORE-18837
This commit is contained in:
Katayama Hirofumi MZ 2023-03-16 10:18:54 +09:00 committed by GitHub
parent 75ac9f8477
commit 136f23578f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -462,6 +462,7 @@ static int AlertFileDoesNotExist(LPCTSTR szFileName)
static BOOL HandleCommandLine(LPTSTR cmdline)
{
BOOL opt_print = FALSE;
TCHAR szPath[MAX_PATH];
while (*cmdline == _T(' ') || *cmdline == _T('-') || *cmdline == _T('/'))
{
@ -518,9 +519,11 @@ static BOOL HandleCommandLine(LPTSTR cmdline)
}
}
GetFullPathName(file_name, ARRAY_SIZE(szPath), szPath, NULL);
if (file_exists)
{
DoOpenFile(file_name);
DoOpenFile(szPath);
InvalidateRect(Globals.hMainWnd, NULL, FALSE);
if (opt_print)
{
@ -530,9 +533,10 @@ static BOOL HandleCommandLine(LPTSTR cmdline)
}
else
{
switch (AlertFileDoesNotExist(file_name)) {
switch (AlertFileDoesNotExist(file_name))
{
case IDYES:
DoOpenFile(file_name);
DoOpenFile(szPath);
break;
case IDNO: