Index: src/ch/AppHelper.cpp =================================================================== diff -u -ra0a0c78670588f86c6be24afb076e6b304441563 -rf2eab440135dd8052881aa3e9af83ec85e9bf1bf --- src/ch/AppHelper.cpp (.../AppHelper.cpp) (revision a0a0c78670588f86c6be24afb076e6b304441563) +++ src/ch/AppHelper.cpp (.../AppHelper.cpp) (revision f2eab440135dd8052881aa3e9af83ec85e9bf1bf) @@ -220,17 +220,7 @@ bool CAppHelper::GetProgramDataPath(CString& rStrPath) { - if(!m_optPortableMode.is_initialized()) - { - // check if the ch.ini exists in the program's directory - it is the only way we can determine portable mode - CString strPortableCfgPath = CString(GetProgramPath()) + _T("\\ch.xml"); - if(GetFileAttributes(strPortableCfgPath) == INVALID_FILE_ATTRIBUTES) - m_optPortableMode = false; - else - m_optPortableMode = true; - - } - if(m_optPortableMode.get() == true) + if(IsInPortableMode()) rStrPath = GetProgramPath(); else { @@ -255,6 +245,21 @@ return true; } +bool CAppHelper::IsInPortableMode() +{ + if(!m_optPortableMode.is_initialized()) + { + // check if the ch.ini exists in the program's directory - it is the only way we can determine portable mode + CString strPortableCfgPath = CString(GetProgramPath()) + _T("\\ch.xml"); + if(GetFileAttributes(strPortableCfgPath) == INVALID_FILE_ATTRIBUTES) + m_optPortableMode = false; + else + m_optPortableMode = true; + } + + return m_optPortableMode.get(); +} + bool CAppHelper::SetAutorun(bool bEnable) { // check the current key value (to avoid irritating messages from some firewall software) Index: src/ch/AppHelper.h =================================================================== diff -u -ra0a0c78670588f86c6be24afb076e6b304441563 -rf2eab440135dd8052881aa3e9af83ec85e9bf1bf --- src/ch/AppHelper.h (.../AppHelper.h) (revision a0a0c78670588f86c6be24afb076e6b304441563) +++ src/ch/AppHelper.h (.../AppHelper.h) (revision f2eab440135dd8052881aa3e9af83ec85e9bf1bf) @@ -41,6 +41,8 @@ bool GetProgramDataPath(CString& rStrPath); + bool IsInPortableMode(); + protected: void InitProtection(); // optional call - protects from running multiple instance void RetrievePaths(); // reads program's path and name Index: src/ch/MainWnd.cpp =================================================================== diff -u -rf06a3b6d1213c029a15a2d3544f2792bdcdacebc -rf2eab440135dd8052881aa3e9af83ec85e9bf1bf --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision f06a3b6d1213c029a15a2d3544f2792bdcdacebc) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision f2eab440135dd8052881aa3e9af83ec85e9bf1bf) @@ -119,7 +119,8 @@ HICON hIcon = (HICON)GetResManager().LoadImage(MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR | LR_VGACOLOR); CString strText = GetApp().GetAppNameVer(); - strText += GetResManager().LoadString(IDS_CH_PORTABLE_STRING); + if(GetApp().IsInPortableMode()) + strText += GetResManager().LoadString(IDS_CH_PORTABLE_STRING); bool bRes=m_ctlTray.CreateIcon(m_hWnd, WM_TRAYNOTIFY, strText, hIcon, 0); if(!bRes) @@ -365,7 +366,8 @@ else { CString strText = GetApp().GetAppNameVer(); - strText += GetResManager().LoadString(IDS_CH_PORTABLE_STRING); + if(GetApp().IsInPortableMode()) + strText += GetResManager().LoadString(IDS_CH_PORTABLE_STRING); m_ctlTray.SetTooltipText(strText); } break;