mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Notepad will no longer add .txt if you invoke it specifying a file that does not exist, but has a file extension
svn path=/trunk/; revision=18765
This commit is contained in:
parent
e0968c78d0
commit
0345348a28
3 changed files with 16 additions and 4 deletions
|
@ -139,6 +139,17 @@ BOOL FileExists(LPCWSTR szFilename)
|
|||
}
|
||||
|
||||
|
||||
BOOL HasFileExtension(LPCWSTR szFilename)
|
||||
{
|
||||
LPCWSTR s;
|
||||
|
||||
s = wcsrchr(szFilename, '\\');
|
||||
if (s)
|
||||
szFilename = s;
|
||||
return wcsrchr(szFilename, '.') != NULL;
|
||||
}
|
||||
|
||||
|
||||
static VOID DoSaveFile(VOID)
|
||||
{
|
||||
HANDLE hFile;
|
||||
|
|
|
@ -55,5 +55,6 @@ VOID DIALOG_TimeDate(VOID);
|
|||
/* utility functions */
|
||||
VOID ShowLastError(void);
|
||||
BOOL FileExists(LPCWSTR szFilename);
|
||||
BOOL HasFileExtension(LPCWSTR szFilename);
|
||||
BOOL DoCloseFile(void);
|
||||
void DoOpenFile(LPCWSTR szFileName);
|
||||
|
|
|
@ -440,8 +440,8 @@ static void HandleCommandLine(LPWSTR cmdline)
|
|||
if (*cmdline)
|
||||
{
|
||||
/* file name is passed in the command line */
|
||||
LPCWSTR file_name;
|
||||
BOOL file_exists;
|
||||
LPCWSTR file_name = NULL;
|
||||
BOOL file_exists = FALSE;
|
||||
WCHAR buf[MAX_PATH];
|
||||
|
||||
if (cmdline[0] == '"')
|
||||
|
@ -455,7 +455,7 @@ static void HandleCommandLine(LPWSTR cmdline)
|
|||
file_exists = TRUE;
|
||||
file_name = cmdline;
|
||||
}
|
||||
else
|
||||
else if (!HasFileExtension(cmdline))
|
||||
{
|
||||
static const WCHAR txtW[] = { '.','t','x','t',0 };
|
||||
|
||||
|
@ -463,7 +463,6 @@ static void HandleCommandLine(LPWSTR cmdline)
|
|||
if (!lstrcmp(txtW, cmdline + lstrlen(cmdline) - lstrlen(txtW)))
|
||||
{
|
||||
file_exists = FALSE;
|
||||
file_name = cmdline;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -476,6 +475,7 @@ static void HandleCommandLine(LPWSTR cmdline)
|
|||
|
||||
if (file_exists)
|
||||
{
|
||||
file_name = cmdline;
|
||||
DoOpenFile(file_name);
|
||||
InvalidateRect(Globals.hMainWnd, NULL, FALSE);
|
||||
if (opt_print)
|
||||
|
|
Loading…
Reference in a new issue