From 651aa9e4a58f47f66123be021f14263bd7862c1e Mon Sep 17 00:00:00 2001 From: gocha Date: Mon, 19 Oct 2009 04:39:19 +0000 Subject: [PATCH] win32: improved Edit action of Lua console. it tries to open a script by other ways if there is no association with "edit" action. --- desmume/src/windows/luaconsole.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/desmume/src/windows/luaconsole.cpp b/desmume/src/windows/luaconsole.cpp index 08945d5dc..ea29f7047 100644 --- a/desmume/src/windows/luaconsole.cpp +++ b/desmume/src/windows/luaconsole.cpp @@ -8,10 +8,10 @@ #include "OpenArchive.h" -#ifdef WIN32 -#include "common.h" -#include "main.h" -#include "driver.h" +#ifdef WIN32 +#include "common.h" +#include "main.h" +#include "driver.h" #endif #include "..\lua-engine.h" @@ -598,7 +598,9 @@ LRESULT CALLBACK LuaScriptProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara { // tell the OS to open the file with its associated editor, // without blocking on it or leaving a command window open. - ShellExecute(NULL, "edit", PhysicalName, NULL, NULL, SW_SHOWNORMAL); + if((int)ShellExecute(NULL, "edit", PhysicalName, NULL, NULL, SW_SHOWNORMAL) == SE_ERR_NOASSOC) + if((int)ShellExecute(NULL, "open", PhysicalName, NULL, NULL, SW_SHOWNORMAL) == SE_ERR_NOASSOC) + ShellExecute(NULL, NULL, "notepad", PhysicalName, NULL, SW_SHOWNORMAL); } if(created) {