OSDN Git Service

Allow using environment variables in temporary path name
authorsdottaka <sdottaka@users.sourceforge.net>
Sun, 17 May 2015 13:45:25 +0000 (22:45 +0900)
committersdottaka <sdottaka@users.sourceforge.net>
Sun, 17 May 2015 13:45:25 +0000 (22:45 +0900)
--HG--
branch : stable

Src/Environment.cpp
Src/MainFrm.cpp
Src/Merge.cpp
Src/Merge.h

index 8286a8b..be294e0 100644 (file)
@@ -27,7 +27,7 @@ static String strProgPath;
 
 void env_SetTempPath(const String& path)
 {
-       strTempPath = paths_AddTrailingSlash(path);
+       strTempPath = paths_AddTrailingSlash(paths_GetLongPath(path));
        paths_CreateIfNeeded(strTempPath);
 }
 
index 1c273ef..9cf3073 100644 (file)
@@ -837,6 +837,9 @@ void CMainFrame::OnOptions()
                        UpdateResources();
                }
 
+               // Set new temporary path
+               theApp.SetupTempPath();
+
                // Set new filterpath
                String filterPath = GetOptionsMgr()->GetString(OPT_FILTER_USERPATH);
                theApp.m_pGlobalFileFilter->SetUserFilterPath(filterPath);
index 4e29ba1..adca0f1 100644 (file)
@@ -288,11 +288,7 @@ BOOL CMergeApp::InitInstance()
        OptionsInit(); // Implementation in OptionsInit.cpp
 
        // Initialize temp folder
-       String instTemp = env_GetPerInstanceString(TempFolderPrefix);
-       if (GetOptionsMgr()->GetBool(OPT_USE_SYSTEM_TEMP_PATH))
-               env_SetTempPath(paths_ConcatPath(env_GetSystemTempPath(), instTemp));
-       else
-               env_SetTempPath(paths_ConcatPath(GetOptionsMgr()->GetString(OPT_CUSTOM_TEMP_PATH), instTemp));
+       SetupTempPath();
 
        // Cleanup left over tempfiles from previous instances.
        // Normally this should not neet to do anything - but if for some reason
@@ -1371,6 +1367,15 @@ void CMergeApp::AddToRecentProjectsMRU(LPCTSTR sPathName)
        }
 }
 
+void CMergeApp::SetupTempPath()
+{
+       String instTemp = env_GetPerInstanceString(TempFolderPrefix);
+       if (GetOptionsMgr()->GetBool(OPT_USE_SYSTEM_TEMP_PATH))
+               env_SetTempPath(paths_ConcatPath(env_GetSystemTempPath(), instTemp));
+       else
+               env_SetTempPath(paths_ConcatPath(GetOptionsMgr()->GetString(OPT_CUSTOM_TEMP_PATH), instTemp));
+}
+
 /**
  * @brief Handles menu selection from recent projects list
  * @param [in] nID Menu ID of the selected item
index 7c4b18f..9ac5e3f 100644 (file)
@@ -148,6 +148,7 @@ public:
        BOOL SyncFileToVCS(const String& pszDest,       BOOL &bApplyToAll, String& psError);
        bool GetMergingMode() const;
        void SetMergingMode(bool bMergingMode);
+       void SetupTempPath();
 
 // Implementation
 protected: