Index: src/ch/AppHelper.cpp =================================================================== diff -u -rc435ab507c8b8280264188b49e9ada56d46c0261 -ra0a0c78670588f86c6be24afb076e6b304441563 --- src/ch/AppHelper.cpp (.../AppHelper.cpp) (revision c435ab507c8b8280264188b49e9ada56d46c0261) +++ src/ch/AppHelper.cpp (.../AppHelper.cpp) (revision a0a0c78670588f86c6be24afb076e6b304441563) @@ -220,21 +220,35 @@ bool CAppHelper::GetProgramDataPath(CString& rStrPath) { - HRESULT hResult = SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, rStrPath.GetBufferSetLength(_MAX_PATH)); - rStrPath.ReleaseBuffer(); - if(FAILED(hResult)) - return false; + 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(rStrPath.Right(1) != _T('\\')) - rStrPath += _T('\\'); + } + if(m_optPortableMode.get() == true) + rStrPath = GetProgramPath(); + else + { + HRESULT hResult = SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, rStrPath.GetBufferSetLength(_MAX_PATH)); + rStrPath.ReleaseBuffer(); + if(FAILED(hResult)) + return false; - // make sure to create the required directories if they does not exist - rStrPath += _T("Copy Handler"); - if(!CreateDirectory(rStrPath, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) - return false; + if(rStrPath.Right(1) != _T('\\')) + rStrPath += _T('\\'); + // make sure to create the required directories if they does not exist + rStrPath += _T("Copy Handler"); + if(!CreateDirectory(rStrPath, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) + return false; + } + // create directory for tasks -// rStrPath += _T("\\Tasks"); if(!CreateDirectory(rStrPath + _T("\\Tasks"), NULL) && GetLastError() != ERROR_ALREADY_EXISTS) return false; Index: src/ch/AppHelper.h =================================================================== diff -u -r4213a6bbd2b543810d29c5a1964917903055d60c -ra0a0c78670588f86c6be24afb076e6b304441563 --- src/ch/AppHelper.h (.../AppHelper.h) (revision 4213a6bbd2b543810d29c5a1964917903055d60c) +++ src/ch/AppHelper.h (.../AppHelper.h) (revision a0a0c78670588f86c6be24afb076e6b304441563) @@ -19,6 +19,8 @@ #ifndef __APPHELPER_H__ #define __APPHELPER_H__ +#include + class CAppHelper { public: @@ -37,7 +39,7 @@ PCTSTR GetProgramPath() const { return m_pszProgramPath; }; PCTSTR GetProgramName() const { return m_pszProgramName; }; - static bool GetProgramDataPath(CString& rStrPath); + bool GetProgramDataPath(CString& rStrPath); protected: void InitProtection(); // optional call - protects from running multiple instance @@ -56,6 +58,8 @@ TCHAR* m_pszAppName; // app-name string of this app TCHAR* m_pszAppNameVer; // extended app-name-with small version TCHAR* m_pszAppVersion; // app-version string of this app (VERSION based) + + boost::optional m_optPortableMode; }; #endif \ No newline at end of file Index: src/ch/MainWnd.cpp =================================================================== diff -u -r3cd8d4a64a63e4fb32d7dc96e46789c713698435 -ra0a0c78670588f86c6be24afb076e6b304441563 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 3cd8d4a64a63e4fb32d7dc96e46789c713698435) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision a0a0c78670588f86c6be24afb076e6b304441563) @@ -112,10 +112,13 @@ int CMainWnd::ShowTrayIcon() { // create system tray icon - HICON hIcon=(HICON)GetResManager().LoadImage(MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR | LR_VGACOLOR); - PCTSTR pszAppVer = GetApp().GetAppNameVer(); - bool bRes=m_ctlTray.CreateIcon(m_hWnd, WM_TRAYNOTIFY, pszAppVer, hIcon, 0); - if (!bRes) + 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); + + bool bRes=m_ctlTray.CreateIcon(m_hWnd, WM_TRAYNOTIFY, strText, hIcon, 0); + if(!bRes) { // GetLog()->Log(_T("[CMainWnd] ... creating tray icon failed.")); return -1; Index: src/ch/ch.cpp =================================================================== diff -u -r3cd8d4a64a63e4fb32d7dc96e46789c713698435 -ra0a0c78670588f86c6be24afb076e6b304441563 --- src/ch/ch.cpp (.../ch.cpp) (revision 3cd8d4a64a63e4fb32d7dc96e46789c713698435) +++ src/ch/ch.cpp (.../ch.cpp) (revision a0a0c78670588f86c6be24afb076e6b304441563) @@ -235,7 +235,7 @@ // ================================= Logging ======================================== // initialize the global log file if it is requested by configuration file - strLogPath = strPath + + _T("\\ch.log"); + strLogPath = strPath + _T("\\ch.log"); chcore::TLogger& rLogger = chcore::TLogger::Acquire(); try Index: src/ch/ch.rc =================================================================== diff -u -r3cd8d4a64a63e4fb32d7dc96e46789c713698435 -ra0a0c78670588f86c6be24afb076e6b304441563 --- src/ch/ch.rc (.../ch.rc) (revision 3cd8d4a64a63e4fb32d7dc96e46789c713698435) +++ src/ch/ch.rc (.../ch.rc) (revision a0a0c78670588f86c6be24afb076e6b304441563) @@ -826,18 +826,18 @@ STRINGTABLE BEGIN - IDS_STATUS_SEARCHING_STRING "Searching" - IDS_STATUS_COPYING_STRING "Copying" - IDS_STATUS_MOVING_STRING "Moving" - IDS_STATUS_FINISHED_STRING "Finished" - IDS_STATUS_ERROR_STRING "Error" - IDS_STATUS_PAUSED_STRING "Paused" - IDS_STATUS_DELETING_STRING "Deleting" - IDS_STATUS_UNKNOWN_STRING "Unknown" - IDS_STATUS_CANCELLED_STRING "Cancelled" - IDS_STATUS_WAITING_STRING "Waiting" - IDS_STATUS_ONLY_FILES_STRING "Only files" - IDS_STATUS_WITHOUT_CONTENTS_STRING "Without contents" + IDS_STATUS_SEARCHING_STRING "Searching" + IDS_STATUS_COPYING_STRING "Copying" + IDS_STATUS_MOVING_STRING "Moving" + IDS_STATUS_FINISHED_STRING "Finished" + IDS_STATUS_ERROR_STRING "Error" + IDS_STATUS_PAUSED_STRING "Paused" + IDS_STATUS_DELETING_STRING "Deleting" + IDS_STATUS_UNKNOWN_STRING "Unknown" + IDS_STATUS_CANCELLED_STRING "Cancelled" + IDS_STATUS_WAITING_STRING "Waiting" + IDS_STATUS_ONLY_FILES_STRING "Only files" + IDS_STATUS_WITHOUT_CONTENTS_STRING "Without contents" IDS_STATUS_INITIALIZING_STRING "Initializing" IDS_SHELLEXECUTEERROR_STRING "Error #%errno calling ShellExecute for file %path" @@ -1057,6 +1057,7 @@ IDS_SHELL_EXTENSION_MISMATCH_STRING "Copy Handler encountered incompatible version of component enabling integration with system installed on your system.\nWould you like to update it now (requires administrative rights)?" IDS_SHELL_EXTENSION_UNREGISTERED_STRING "Copy Handler's component enabling integration with system is disabled.\nDo you want to enable it now (requires administrative rights)?" IDS_SHELL_EXTENSION_REGISTERED_MISMATCH_STRING "Copy Handler's component enabling integration with system was updated.\nPlease reboot your system for changes to take effect." + IDS_CH_PORTABLE_STRING " (portable mode)" END STRINGTABLE Index: src/ch/resource.h =================================================================== diff -u -r3cd8d4a64a63e4fb32d7dc96e46789c713698435 -ra0a0c78670588f86c6be24afb076e6b304441563 --- src/ch/resource.h (.../resource.h) (revision 3cd8d4a64a63e4fb32d7dc96e46789c713698435) +++ src/ch/resource.h (.../resource.h) (revision a0a0c78670588f86c6be24afb076e6b304441563) @@ -318,6 +318,7 @@ #define IDS_SHELL_EXTENSION_MISMATCH_STRING 5027 #define IDS_SHELL_EXTENSION_UNREGISTERED_STRING 5028 #define IDS_SHELL_EXTENSION_REGISTERED_MISMATCH_STRING 5029 +#define IDS_CH_PORTABLE_STRING 5030 #define IDS_ONECOPY_STRING 6000 #define IDS_REGISTEROK_STRING 6001 #define IDS_REGISTERERR_STRING 6002 @@ -384,7 +385,7 @@ #define IDS_CFGSHCMTOSPECIAL_STRING 8062 #define IDS_CFGSHSHOWFREESPACE_STRING 8063 #define IDS_CFGSHSHOWICONS_STRING 8064 -#define IDS_CFGSHINTERCEPTDRAG_STRING 8065 +#define IDS_CFGSHINTERCEPTDRAG_STRING 8065 #define IDS_CFGSHORTCUTS_STRING 8066 #define IDS_CFGRECENT_STRING 8067 #define IDS_CFGSHELL_STRING 8068 @@ -413,10 +414,10 @@ #define IDS_ABOUT_LANGUAGE_STRING 8095 #define IDS_CFGINTERCEPTCONTEXTMENU_STRING 8096 #define IDS_CFG_CHECK_FOR_UPDATES_FREQUENCY 8097 -#define IDS_CFG_UPDATE_CHECK_FOR_BETA 8098 -#define IDS_CFGLOGLEVEL 8099 -#define IDS_CFGLOGLEVEL_VALUES 8100 -#define IDS_UPDATE_FREQUENCIES 8101 +#define IDS_CFG_UPDATE_CHECK_FOR_BETA 8098 +#define IDS_CFGLOGLEVEL 8099 +#define IDS_CFGLOGLEVEL_VALUES 8100 +#define IDS_UPDATE_FREQUENCIES 8101 #define IDS_MENUCOPY_STRING 9000 #define IDS_MENUMOVE_STRING 9001 #define IDS_MENUCOPYMOVESPECIAL_STRING 9002 @@ -478,7 +479,7 @@ #define IDS_TITLEMOVE_STRING 13501 #define IDS_TITLEUNKNOWNOPERATION_STRING 13502 #define IDS_MAINBROWSETEXT_STRING 13503 -#define IDS_INFO_TWO_FILE_STRING 13504 +#define IDS_INFO_TWO_FILE_STRING 13504 #define IDS_ABTNOTHANX_STRING 14000 #define IDS_ABOUTVERSION_STRING 14001 #define IDS_BUFFERSIZEZERO_STRING 14500 @@ -535,18 +536,18 @@ #define IDS_TASKNOTPAUSED_STRING 21517 #define IDS_TASKNOTSELECTED_STRING 21518 #define IDS_NONEINPUTFILE_STRING 21519 -#define IDS_STATUS_SEARCHING_STRING 21522 -#define IDS_STATUS_COPYING_STRING 21523 -#define IDS_STATUS_MOVING_STRING 21524 -#define IDS_STATUS_FINISHED_STRING 21525 -#define IDS_STATUS_ERROR_STRING 21526 -#define IDS_STATUS_PAUSED_STRING 21527 -#define IDS_STATUS_DELETING_STRING 21528 -#define IDS_STATUS_UNKNOWN_STRING 21529 -#define IDS_STATUS_CANCELLED_STRING 21530 -#define IDS_STATUS_WAITING_STRING 21531 -#define IDS_STATUS_ONLY_FILES_STRING 21532 -#define IDS_STATUS_WITHOUT_CONTENTS_STRING 21533 +#define IDS_STATUS_SEARCHING_STRING 21522 +#define IDS_STATUS_COPYING_STRING 21523 +#define IDS_STATUS_MOVING_STRING 21524 +#define IDS_STATUS_FINISHED_STRING 21525 +#define IDS_STATUS_ERROR_STRING 21526 +#define IDS_STATUS_PAUSED_STRING 21527 +#define IDS_STATUS_DELETING_STRING 21528 +#define IDS_STATUS_UNKNOWN_STRING 21529 +#define IDS_STATUS_CANCELLED_STRING 21530 +#define IDS_STATUS_WAITING_STRING 21531 +#define IDS_STATUS_ONLY_FILES_STRING 21532 +#define IDS_STATUS_WITHOUT_CONTENTS_STRING 21533 #define IDS_SHELLEXECUTEERROR_STRING 21534 #define IDS_BSDEFAULT_STRING 21535 #define IDS_BSONEDISK_STRING 21536 @@ -556,7 +557,7 @@ #define IDS_EMPTYASSOCFILE_STRING 21549 #define IDS_FILTERING_STRING 21550 #define IDS_CONFIRMCANCEL_STRING 21551 -#define IDS_STATUS_INITIALIZING_STRING 21552 +#define IDS_STATUS_INITIALIZING_STRING 21552 #define ID_POPUP_SHOW_STATUS 32773 #define ID_POPUP_TIME_CRITICAL 32774 #define ID_POPUP_HIGHEST 32775