https://git.reactos.org/?p=reactos.git;a=commitdiff;h=136f23578f26247da1618…
commit 136f23578f26247da1618a5b36568bb3831b1e2d
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Mar 16 10:18:54 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Mar 16 10:18:54 2023 +0900
[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
---
base/applications/notepad/main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/base/applications/notepad/main.c b/base/applications/notepad/main.c
index e92e1e8ec0b..3f30dd2a3fd 100644
--- a/base/applications/notepad/main.c
+++ b/base/applications/notepad/main.c
@@ -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: