svn path=/trunk/; revision=18765
+BOOL HasFileExtension(LPCWSTR szFilename)
+{
+ LPCWSTR s;
+
+ s = wcsrchr(szFilename, '\\');
+ if (s)
+ szFilename = s;
+ return wcsrchr(szFilename, '.') != NULL;
+}
+
+
static VOID DoSaveFile(VOID)
{
HANDLE hFile;
static VOID DoSaveFile(VOID)
{
HANDLE hFile;
/* utility functions */
VOID ShowLastError(void);
BOOL FileExists(LPCWSTR szFilename);
/* utility functions */
VOID ShowLastError(void);
BOOL FileExists(LPCWSTR szFilename);
+BOOL HasFileExtension(LPCWSTR szFilename);
BOOL DoCloseFile(void);
void DoOpenFile(LPCWSTR szFileName);
BOOL DoCloseFile(void);
void DoOpenFile(LPCWSTR szFileName);
if (*cmdline)
{
/* file name is passed in the command line */
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] == '"')
WCHAR buf[MAX_PATH];
if (cmdline[0] == '"')
file_exists = TRUE;
file_name = cmdline;
}
file_exists = TRUE;
file_name = cmdline;
}
+ else if (!HasFileExtension(cmdline))
{
static const WCHAR txtW[] = { '.','t','x','t',0 };
{
static const WCHAR txtW[] = { '.','t','x','t',0 };
if (!lstrcmp(txtW, cmdline + lstrlen(cmdline) - lstrlen(txtW)))
{
file_exists = FALSE;
if (!lstrcmp(txtW, cmdline + lstrlen(cmdline) - lstrlen(txtW)))
{
file_exists = FALSE;
DoOpenFile(file_name);
InvalidateRect(Globals.hMainWnd, NULL, FALSE);
if (opt_print)
DoOpenFile(file_name);
InvalidateRect(Globals.hMainWnd, NULL, FALSE);
if (opt_print)