- Set the initial value of the path of the external editor to% windir%\NOTEPAD.EXE
return true;
}
+String ExpandEnvironmentVariables(const String& text)
+{
+ TCHAR buf[512];
+ buf[0] = 0;
+ const unsigned size = sizeof(buf) / sizeof(buf[0]);
+ const unsigned expandedSize = ::ExpandEnvironmentStrings(text.c_str(), buf, size);
+ if (expandedSize <= size)
+ return buf;
+ std::vector<TCHAR> newbuf(expandedSize);
+ ::ExpandEnvironmentStrings(text.c_str(), newbuf.data(), expandedSize);
+ return newbuf.data();
+}
+
/**
* @brief Load registry keys from .reg file if existing .reg file
*/
String GetPerInstanceString(const String& name);
+String ExpandEnvironmentVariables(const String& text);
+
bool LoadRegistryFromFile(const String& sRegFilePath);
bool SaveRegistryToFile(const String& sRegFilePath, const String& sRegDir);
*/
void CMergeApp::OpenFileToExternalEditor(const String& file, int nLineNumber/* = 1*/)
{
- String sCmd = GetOptionsMgr()->GetString(OPT_EXT_EDITOR_CMD);
+ String sCmd = env::ExpandEnvironmentVariables(GetOptionsMgr()->GetString(OPT_EXT_EDITOR_CMD));
String sFile(file);
strutils::replace(sCmd, _T("$linenum"), strutils::to_str(nLineNumber));
pOptions->InitOption(OPT_TAB_SIZE, (int)4);
pOptions->InitOption(OPT_TAB_TYPE, (int)0); // 0 means tabs inserted
- pOptions->InitOption(OPT_EXT_EDITOR_CMD, paths::ConcatPath(env::GetWindowsDirectory(), _T("NOTEPAD.EXE")));
+ pOptions->InitOption(OPT_EXT_EDITOR_CMD, _T("%windir%\\NOTEPAD.EXE"));
pOptions->InitOption(OPT_USE_RECYCLE_BIN, true);
pOptions->InitOption(OPT_SINGLE_INSTANCE, 0);
pOptions->InitOption(OPT_MERGE_MODE, false);