OSDN Git Service

Replace env_* with env::*
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 4 Dec 2016 11:38:32 +0000 (20:38 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 4 Dec 2016 11:38:32 +0000 (20:38 +0900)
25 files changed:
Src/7zCommon.cpp
Src/Common/LanguageSelect.cpp
Src/Common/multiformatText.cpp
Src/ConfigLog.cpp
Src/DiffTextBuffer.cpp
Src/DiffWrapper.cpp
Src/DropHandler.cpp
Src/Environment.cpp
Src/Environment.h
Src/FileFilterHelper.cpp
Src/FileTransform.cpp
Src/FilterCommentsManager.cpp
Src/HexMergeView.cpp
Src/MainFrm.cpp
Src/Merge.cpp
Src/MergeDoc.cpp
Src/OptionsInit.cpp
Src/PatchDlg.cpp
Src/Plugins.cpp
Src/PropShell.cpp
Src/TempFile.cpp
Src/VSSHelper.cpp
Testing/GoogleTest/Environment/Environemt_test.cpp
Testing/GoogleTest/FileFilter/FileFilterHelper_test.cpp
Testing/GoogleTest/Plugins/Plugins_test.cpp

index bd97b88..939698b 100644 (file)
@@ -264,7 +264,7 @@ void CTempPathContext::Swap(int idx1, int idx2)
  */\r
 DWORD NTAPI VersionOf7z()\r
 {\r
-       String path = paths::ConcatPath(env_GetProgPath(), _T("Merge7z\\7z.dll"));\r
+       String path = paths::ConcatPath(env::GetProgPath(), _T("Merge7z\\7z.dll"));\r
        unsigned versionMS = 0;\r
        unsigned versionLS = 0;\r
        CVersionInfo(path.c_str()).GetFixedFileVersion(versionMS, versionLS);\r
@@ -627,7 +627,7 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
                if (piHandler = ArchiveGuessFormat(res.files[0]))\r
                {\r
                        res.pTempPathContext = new CTempPathContext;\r
-                       path = env_GetTempChildPath();\r
+                       path = env::GetTempChildPath();\r
                        for (int index = 0; index < res.files.GetSize(); index++)\r
                                res.pTempPathContext->m_strDisplayRoot[index] = res.files[index];\r
                        if (res.files.GetSize() == 2 && res.files[0] == res.files[1])\r
@@ -656,7 +656,7 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
                                for (int index = 0; index < res.files.GetSize(); index++)\r
                                        res.pTempPathContext->m_strDisplayRoot[index] = res.files[index];\r
                        }\r
-                       path = env_GetTempChildPath();\r
+                       path = env::GetTempChildPath();\r
                        do\r
                        {\r
                                if (FAILED(piHandler->DeCompressArchive(hWnd, res.files[1].c_str(), path.c_str())))\r
@@ -681,7 +681,7 @@ DecompressResult DecompressArchive(HWND hWnd, const PathContext& files)
                                for (int index = 0; index < res.files.GetSize(); index++)\r
                                        res.pTempPathContext->m_strDisplayRoot[index] = res.files[index];\r
                        }\r
-                       path = env_GetTempChildPath();\r
+                       path = env::GetTempChildPath();\r
                        do\r
                        {\r
                                if (FAILED(piHandler->DeCompressArchive(hWnd, res.files[2].c_str(), path.c_str())))\r
index 1b05393..363b4aa 100644 (file)
@@ -807,7 +807,7 @@ BOOL CLanguageSelect::SetLanguage(LANGID wLangId, BOOL bShowError)
 String CLanguageSelect::GetFileName(LANGID wLangId) const
 {
        String filename;
-       String path = paths::ConcatPath(env_GetProgPath(), szRelativePath);
+       String path = paths::ConcatPath(env::GetProgPath(), szRelativePath);
        String pattern = paths::ConcatPath(path, _T("*.po"));
        WIN32_FIND_DATA ff;
        HANDLE h = INVALID_HANDLE_VALUE;
@@ -1032,7 +1032,7 @@ std::wstring CLanguageSelect::LoadDialogCaption(LPCTSTR lpDialogTemplateID) cons
 std::vector<std::pair<LANGID, String> > CLanguageSelect::GetAvailableLanguages() const
 {
        std::vector<std::pair<LANGID, String> > list;
-       String path = paths::ConcatPath(env_GetProgPath(), szRelativePath);
+       String path = paths::ConcatPath(env::GetProgPath(), szRelativePath);
        String pattern = paths::ConcatPath(path, _T("*.po"));
        WIN32_FIND_DATA ff;
        HANDLE h = INVALID_HANDLE_VALUE;
index bbf8f3a..cbdbe97 100644 (file)
@@ -106,7 +106,7 @@ const TCHAR *storageForPlugins::GetDestFileName()
 {
        if (m_tempFilenameDst.empty())
        {
-               m_tempFilenameDst = env_GetTempFileName(env_GetTempPath(), _T ("_WM"));
+               m_tempFilenameDst = env::GetTemporaryFileName(env::GetTemporaryPath(), _T ("_WM"));
        }
        return m_tempFilenameDst.c_str();
 }
index a10b044..5bb6f7e 100644 (file)
@@ -192,7 +192,7 @@ bool CConfigLog::DoFile(String &sError)
        CVersionInfo version;
        String text;
 
-       String sFileName = paths::ConcatPath(env_GetMyDocuments(), WinMergeDocumentsFolder);
+       String sFileName = paths::ConcatPath(env::GetMyDocuments(), WinMergeDocumentsFolder);
        paths::CreateIfNeeded(sFileName);
        m_sFileName = paths::ConcatPath(sFileName, _T("WinMerge.txt"));
 
index 4c018e4..5abc5d3 100644 (file)
@@ -516,7 +516,7 @@ int CDiffTextBuffer::SaveToFile (const String& pszFileName,
        }
        else
        {
-               sIntermediateFilename = env_GetTempFileName(m_strTempPath,
+               sIntermediateFilename = env::GetTemporaryFileName(m_strTempPath,
                        _T("MRG_"), NULL);
                if (sIntermediateFilename.empty())
                        return SAVE_FAILED;  //Nothing to do if even tempfile name fails
index 0a26547..739f77e 100644 (file)
@@ -755,7 +755,7 @@ bool CDiffWrapper::RunFileDiff()
                // what differences diff-engine sees!
 #ifdef _DEBUG
                // throw the diff into a temp file
-               String sTempPath = env_GetTempPath(); // get path to Temp folder
+               String sTempPath = env::GetTemporaryPath(); // get path to Temp folder
                String path = paths::ConcatPath(sTempPath, _T("Diff.txt"));
 
                outfile = _tfopen(path.c_str(), _T("w+"));
index 4346bc2..0d4eb18 100644 (file)
@@ -81,7 +81,7 @@ namespace
                        }
                        else if (paths::IsDecendant(files[i], szTempPath) || paths::IsDecendant(files[i], szTempPathShort))
                        {
-                               String tmpdir = env_GetTempChildPath();
+                               String tmpdir = env::GetTempChildPath();
                                CopyFileOrFolder(files[i], tmpdir);
                                files[i] = paths::ConcatPath(tmpdir, paths::FindFileName(files[i]));
                        }
@@ -197,7 +197,7 @@ namespace
                                                        if (SUCCEEDED(hr = pFileOperation.CreateInstance(CLSID_FileOperation, NULL, CLSCTX_ALL)))
                                                        {
                                                                if (tmpdir.empty())
-                                                                       tmpdir = env_GetTempChildPath();
+                                                                       tmpdir = env::GetTempChildPath();
                                                                pFileOperation->SetOperationFlags(0);
                                                                PIDLIST_ABSOLUTE pidlDest;
                                                                if (SUCCEEDED(hr = SHParseDisplayName(ucr::toUTF16(tmpdir).c_str(), NULL, &pidlDest, 0, NULL)))
@@ -245,7 +245,7 @@ namespace
 
        HRESULT GetFileItemsFromIDataObject_FileDescriptor(IDataObject *pDataObj, std::vector<String>& root_files)
        {
-               String tmpdir = env_GetTempChildPath();
+               String tmpdir = env::GetTempChildPath();
                FORMATETC fmtetc_filedescriptor = { static_cast<WORD>(RegisterClipboardFormat(CFSTR_FILEDESCRIPTOR)), NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
                STGMEDIUM medium = { 0 };
                HRESULT hr;
index 3327036..13aadcf 100644 (file)
 using Poco::Path;
 using Poco::Process;
 
+namespace env
+{
+
 /**
  * @brief Temp path.
- * Static string used by env_GetTempPath() for storing temp path.
+ * Static string used by GetTemporaryPath() for storing temp path.
  */
 static String strTempPath;
 static String strProgPath;
 
-void env_SetTempPath(const String& path)
+void SetTemporaryPath(const String& path)
 {
        strTempPath = paths::AddTrailingSlash(paths::GetLongPath(path));
        paths::CreateIfNeeded(strTempPath);
@@ -37,11 +40,11 @@ void env_SetTempPath(const String& path)
  * @note Temp path is cached after first call.
  * @todo Should we return NULL for error case?
  */
-String env_GetTempPath()
+String GetTemporaryPath()
 {
        if (strTempPath.empty())
        {
-               strTempPath = env_GetSystemTempPath();
+               strTempPath = GetSystemTempPath();
                if (strTempPath.empty())
                        return strTempPath;
 
@@ -57,12 +60,12 @@ String env_GetTempPath()
  * @param [out] pnerr Error code if error happened.
  * @return Full path for temporary file or empty string if error happened.
  */
-String env_GetTempFileName(const String& lpPathName, const String& lpPrefixString, int * pnerr)
+String GetTemporaryFileName(const String& lpPathName, const String& lpPrefixString, int * pnerr)
 {
        TCHAR buffer[MAX_PATH] = {0};
        if (lpPathName.length() > MAX_PATH-14)
                return _T(""); // failure
-       int rtn = GetTempFileName(lpPathName.c_str(), lpPrefixString.c_str(), 0, buffer);
+       int rtn = ::GetTempFileName(lpPathName.c_str(), lpPrefixString.c_str(), 0, buffer);
        if (!rtn)
        {
                int err = GetLastError();
@@ -73,22 +76,22 @@ String env_GetTempFileName(const String& lpPathName, const String& lpPrefixStrin
        return buffer;
 }
 
-String env_GetTempChildPath()
+String GetTempChildPath()
 {
        String path;
        do
        {
-               path = paths::ConcatPath(env_GetTempPath(), string_format(_T("%08x"), rand()));
+               path = paths::ConcatPath(GetTemporaryPath(), string_format(_T("%08x"), rand()));
        } while (paths::IsDirectory(path) || !paths::CreateIfNeeded(path));
        return path;
 }
 
-void env_SetProgPath(const String& path)
+void SetProgPath(const String& path)
 {
        strProgPath = paths::AddTrailingSlash(path);
 }
 
-String env_GetProgPath()
+String GetProgPath()
 {
        if (strProgPath.empty())
        {
@@ -103,11 +106,11 @@ String env_GetProgPath()
  * @brief Get Windows directory.
  * @return Windows directory.
  */
-String env_GetWindowsDirectory()
+String GetWindowsDirectory()
 {
        TCHAR path[MAX_PATH];
        path[0] = _T('\0');
-       GetWindowsDirectory(path, MAX_PATH);
+       ::GetWindowsDirectory(path, MAX_PATH);
        return path;
 }
 
@@ -116,7 +119,7 @@ String env_GetWindowsDirectory()
  * This function returns full path to User's My Documents -folder.
  * @return Full path to My Documents -folder.
  */
-String env_GetMyDocuments()
+String GetMyDocuments()
 {
        TCHAR path[MAX_PATH];
        path[0] = _T('\0');
@@ -131,7 +134,7 @@ String env_GetMyDocuments()
  * @param [in] name Additional name used as part of the string.
  * @return Unique string for the instance.
  */
-String env_GetPerInstanceString(const String& name)
+String GetPerInstanceString(const String& name)
 {
        std::basic_stringstream<TCHAR> stream;
        stream << name << Process::id();
@@ -142,7 +145,7 @@ String env_GetPerInstanceString(const String& name)
  * @brief Get system temporary directory.
  * @return System temporary director.
  */
-String env_GetSystemTempPath()
+String GetSystemTempPath()
 {
        try
        {
@@ -173,7 +176,7 @@ static bool launchProgram(const String& sCmd, WORD wShowWindow)
 /**
  * @brief Load registry keys from .reg file if existing .reg file
  */
-bool env_LoadRegistryFromFile(const String& sRegFilePath)
+bool LoadRegistryFromFile(const String& sRegFilePath)
 {
        if (paths::DoesPathExist(sRegFilePath) != paths::IS_EXISTING_FILE)
                return false;
@@ -183,10 +186,12 @@ bool env_LoadRegistryFromFile(const String& sRegFilePath)
 /** 
  * @brief Save registry keys to .reg file if existing .reg file
  */
-bool env_SaveRegistryToFile(const String& sRegFilePath, const String& sRegDir)
+bool SaveRegistryToFile(const String& sRegFilePath, const String& sRegDir)
 {
        if (paths::DoesPathExist(sRegFilePath) != paths::IS_EXISTING_FILE)
                return false;
        DeleteFile(sRegFilePath.c_str());
        return launchProgram(_T("reg.exe export HKCU\\") + sRegDir + _T(" \"") + sRegFilePath + _T("\""), SW_HIDE);
 }
+
+}
index 4dfcd59..84c38a2 100644 (file)
@@ -7,19 +7,24 @@
 
 #include "UnicodeString.h"
 
-void env_SetTempPath(const String& path);
-String env_GetTempPath();
-String env_GetTempFileName(const String& lpPathName, const String& lpPrefixString,
+namespace env
+{
+
+void SetTemporaryPath(const String& path);
+String GetTemporaryPath();
+String GetTemporaryFileName(const String& lpPathName, const String& lpPrefixString,
                int * pnerr = NULL);
-String env_GetTempChildPath();
-void env_SetProgPath(const String& path);
-String env_GetProgPath();
+String GetTempChildPath();
+void SetProgPath(const String& path);
+String GetProgPath();
+
+String GetWindowsDirectory();
+String GetMyDocuments();
+String GetSystemTempPath();
 
-String env_GetWindowsDirectory();
-String env_GetMyDocuments();
-String env_GetSystemTempPath();
+String GetPerInstanceString(const String& name);
 
-String env_GetPerInstanceString(const String& name);
+bool LoadRegistryFromFile(const String& sRegFilePath);
+bool SaveRegistryToFile(const String& sRegFilePath, const String& sRegDir);
 
-bool env_LoadRegistryFromFile(const String& sRegFilePath);
-bool env_SaveRegistryToFile(const String& sRegFilePath, const String& sRegDir);
+}
index 14ea7ae..877f16e 100644 (file)
@@ -454,7 +454,7 @@ void FileFilterHelper::LoadAllFileFilters()
        m_fileFilterMgr->DeleteAllFilters();
 
        // Program application directory
-       m_sGlobalFilterPath = paths::ConcatPath(env_GetProgPath(), _T("Filters"));
+       m_sGlobalFilterPath = paths::ConcatPath(env::GetProgPath(), _T("Filters"));
        paths::normalize(m_sGlobalFilterPath);
        String pattern(_T("*"));
        pattern += FileFilterExt;
index 1a7f3c8..0f3a1c9 100644 (file)
@@ -394,10 +394,10 @@ bool FileTransform_Prediffing(PrediffingInfo * handler, String & filepath, const
 
 bool FileTransform_AnyCodepageToUTF8(int codepage, String & filepath, bool bMayOverwrite)
 {
-       String tempDir = env_GetTempPath();
+       String tempDir = env::GetTemporaryPath();
        if (tempDir.empty())
                return false;
-       String tempFilepath = env_GetTempFileName(tempDir, _T("_W3"));
+       String tempFilepath = env::GetTemporaryFileName(tempDir, _T("_W3"));
        if (tempFilepath.empty())
                return false;
        // TODO : is it better with the BOM or without (just change the last argument)
index 1740195..090b7b3 100644 (file)
@@ -50,7 +50,7 @@ void FilterCommentsManager::Load()
        int SectionNo = 0;\r
        if (m_IniFileName.empty())\r
        {\r
-               m_IniFileName = paths::ConcatPath(env_GetProgPath(), _T("IgnoreSectionMarkers.ini"));\r
+               m_IniFileName = paths::ConcatPath(env::GetProgPath(), _T("IgnoreSectionMarkers.ini"));\r
        }\r
 \r
        try\r
index d9dab99..c741062 100644 (file)
@@ -311,8 +311,8 @@ HRESULT CHexMergeView::SaveFile(LPCTSTR path)
        if (!theApp.CreateBackup(FALSE, path))
                return S_OK;
        // Write data to an intermediate file
-       String tempPath = env_GetTempPath();
-       String sIntermediateFilename = env_GetTempFileName(tempPath, _T("MRG_"), 0);
+       String tempPath = env::GetTemporaryPath();
+       String sIntermediateFilename = env::GetTemporaryFileName(tempPath, _T("MRG_"), 0);
        if (sIntermediateFilename.empty())
                return E_FAIL; //Nothing to do if even tempfile name fails
        HANDLE h = CreateFile(sIntermediateFilename.c_str(), GENERIC_WRITE, FILE_SHARE_READ,
index 298c25b..be3db21 100644 (file)
@@ -798,7 +798,7 @@ bool CMainFrame::ShowImgMergeDoc(CDirDoc * pDirDoc, int nFiles, const FileLocati
  */
 void CMainFrame::OnHelpGnulicense() 
 {
-       const String spath = paths::ConcatPath(env_GetProgPath(), LicenseFile);
+       const String spath = paths::ConcatPath(env::GetProgPath(), LicenseFile);
        theApp.OpenFileOrUrl(spath.c_str(), LicenceUrl);
 }
 
index 5c77f66..4f230b6 100644 (file)
@@ -279,7 +279,7 @@ BOOL CMergeApp::InitInstance()
        pOldFilter->Revoke();
 
        // Load registry keys from WinMerge.reg if existing WinMerge.reg
-       env_LoadRegistryFromFile(paths::ConcatPath(env_GetProgPath(), _T("WinMerge.reg")));
+       env::LoadRegistryFromFile(paths::ConcatPath(env::GetProgPath(), _T("WinMerge.reg")));
 
        Options::Init(m_pOptions.get()); // Implementation in OptionsInit.cpp
 
@@ -406,7 +406,7 @@ BOOL CMergeApp::InitInstance()
                        // Failed to create a folder for filters, fallback to
                        // "My Documents"-folder. It is not worth the trouble to
                        // bother user about this or user more clever solutions.
-                       GetOptionsMgr()->SaveOption(OPT_FILTER_USERPATH, env_GetMyDocuments());
+                       GetOptionsMgr()->SaveOption(OPT_FILTER_USERPATH, env::GetMyDocuments());
                }
        }
 
@@ -506,7 +506,7 @@ BOOL CMergeApp::InitInstance()
 
 static void OpenContributersFile(int&)
 {
-       theApp.OpenFileToExternalEditor(paths::ConcatPath(env_GetProgPath(), ContributorsPath));
+       theApp.OpenFileToExternalEditor(paths::ConcatPath(env::GetProgPath(), ContributorsPath));
 }
 
 // App command to run the dialog
@@ -532,10 +532,10 @@ int CMergeApp::ExitInstance()
        charsets_cleanup();
 
        //  Save registry keys if existing WinMerge.reg
-       env_SaveRegistryToFile(paths::ConcatPath(env_GetProgPath(), _T("WinMerge.reg")), RegDir);
+       env::SaveRegistryToFile(paths::ConcatPath(env::GetProgPath(), _T("WinMerge.reg")), RegDir);
 
        // Remove tempfolder
-       const String temp = env_GetTempPath();
+       const String temp = env::GetTemporaryPath();
        ClearTempfolder(temp);
        delete m_mainThreadScripts;
        CWinApp::ExitInstance();
@@ -832,7 +832,7 @@ void CMergeApp::OpenFileOrUrl(LPCTSTR szFile, LPCTSTR szUrl)
  */
 void CMergeApp::ShowHelp(LPCTSTR helpLocation /*= NULL*/)
 {
-       String sPath = env_GetProgPath();
+       String sPath = env::GetProgPath();
        LANGID LangId = GetLangId();
        if (PRIMARYLANGID(LangId) == LANG_JAPANESE)
                sPath = paths::ConcatPath(sPath, DocsPath_ja);
@@ -1320,11 +1320,11 @@ void CMergeApp::AddToRecentProjectsMRU(LPCTSTR sPathName)
 
 void CMergeApp::SetupTempPath()
 {
-       String instTemp = env_GetPerInstanceString(TempFolderPrefix);
+       String instTemp = env::GetPerInstanceString(TempFolderPrefix);
        if (GetOptionsMgr()->GetBool(OPT_USE_SYSTEM_TEMP_PATH))
-               env_SetTempPath(paths::ConcatPath(env_GetSystemTempPath(), instTemp));
+               env::SetTemporaryPath(paths::ConcatPath(env::GetSystemTempPath(), instTemp));
        else
-               env_SetTempPath(paths::ConcatPath(GetOptionsMgr()->GetString(OPT_CUSTOM_TEMP_PATH), instTemp));
+               env::SetTemporaryPath(paths::ConcatPath(GetOptionsMgr()->GetString(OPT_CUSTOM_TEMP_PATH), instTemp));
 }
 
 /**
index 40d1db2..2a3f314 100644 (file)
@@ -410,7 +410,7 @@ int CMergeDoc::Rescan(bool &bBinary, IDENTLEVEL &identical,
 
        CheckFileChanged();
 
-       String tempPath = env_GetTempPath();
+       String tempPath = env::GetTemporaryPath();
 
        // Set up DiffWrapper
        m_diffWrapper.GetOptions(&diffOptions);
index c4eaf4f..971c731 100644 (file)
@@ -102,7 +102,7 @@ void Init(COptionsMgr *pOptions)
        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, paths::ConcatPath(env::GetWindowsDirectory(), _T("NOTEPAD.EXE")));
        pOptions->InitOption(OPT_USE_RECYCLE_BIN, true);
        pOptions->InitOption(OPT_SINGLE_INSTANCE, false);
        pOptions->InitOption(OPT_MERGE_MODE, false);
@@ -147,7 +147,7 @@ void Init(COptionsMgr *pOptions)
        pOptions->InitOption(OPT_LINEFILTER_ENABLED, false);
        pOptions->InitOption(OPT_FILEFILTER_CURRENT, _T("*.*"));
        // CMainFrame initializes this when it is empty.
-       pOptions->InitOption(OPT_FILTER_USERPATH, paths::ConcatPath(env_GetMyDocuments(), DefaultRelativeFilterPath));
+       pOptions->InitOption(OPT_FILTER_USERPATH, paths::ConcatPath(env::GetMyDocuments(), DefaultRelativeFilterPath));
        pOptions->InitOption(OPT_FILEFILTER_SHARED, false);
 
        pOptions->InitOption(OPT_CP_DEFAULT_MODE, (int)0);
index 26a5d88..81e4a10 100644 (file)
@@ -133,7 +133,7 @@ void CPatchDlg::OnOK()
                if (m_fileResult.length() == 0)
                {
                        TCHAR szTempFile[MAX_PATH];
-                       GetTempFileName(env_GetTempPath().c_str(), _T("pat"), 0, szTempFile);
+                       ::GetTempFileName(env::GetTemporaryPath().c_str(), _T("pat"), 0, szTempFile);
                        m_fileResult = szTempFile;
                        m_ctlResult.SetWindowText(m_fileResult.c_str());
                        DeleteFile(m_fileResult.c_str());
index 830d493..a29af9a 100644 (file)
@@ -571,7 +571,7 @@ static vector<String>& LoadTheScriptletList()
        FastMutex::ScopedLock lock(scriptletsSem);
        if (!scriptletsLoaded)
        {
-               String path = paths::ConcatPath(env_GetProgPath(), _T("MergePlugins"));
+               String path = paths::ConcatPath(env::GetProgPath(), _T("MergePlugins"));
 
                if (IsWindowsScriptThere())
                        GetScriptletsAt(path, _T(".sct"), theScriptletList );           // VBS/JVS scriptlet
index 8903c6d..7628be3 100644 (file)
@@ -43,7 +43,7 @@ static bool RegisterShellExtension(bool unregister)
        GetSystemDirectory(szSystem32, sizeof(szSystem32) / sizeof(szSystem32[0]));
        GetSystemWow64Directory(szSysWow64, sizeof(szSysWow64) / sizeof(szSysWow64[0]));
 
-       String progpath = env_GetProgPath();
+       String progpath = env::GetProgPath();
        String regsvr32 = paths::ConcatPath(szSystem32, _T("regsvr32.exe"));
        String args;
        SHELLEXECUTEINFO sei = { sizeof(sei) };
index 5a5ecf7..210a421 100644 (file)
@@ -36,7 +36,7 @@ TempFile::~TempFile()
  */
 String TempFile::Create(const String& prefix, const String& ext)
 {
-       String temp = env_GetTempPath();
+       String temp = env::GetTemporaryPath();
        if (temp.empty())
        {
                return _T("");
@@ -46,7 +46,7 @@ String TempFile::Create(const String& prefix, const String& ext)
        if (pref.empty())
                pref = _T("wmtmp");
 
-       temp = env_GetTempFileName(temp, pref, NULL);
+       temp = env::GetTemporaryFileName(temp, pref, NULL);
        if (!temp.empty())
        {
                if (!ext.empty())
@@ -71,7 +71,7 @@ String TempFile::Create(const String& prefix, const String& ext)
  */
 String TempFile::CreateFromFile(const String& filepath, const String& prefix)
 {
-       String temp = env_GetTempPath();
+       String temp = env::GetTemporaryPath();
        if (temp.empty())
        {
                return _T("");
@@ -81,7 +81,7 @@ String TempFile::CreateFromFile(const String& filepath, const String& prefix)
        if (pref.empty())
                pref = _T("wmtmp");
 
-       temp = env_GetTempFileName(temp, pref, NULL);
+       temp = env::GetTemporaryFileName(temp, pref, NULL);
        if (!temp.empty())
        {
                // Scratchpads don't have a file to copy.
@@ -155,7 +155,7 @@ static bool CleanupWMtempfolder(const vector <int>& processIDs)
        String tempfolderPID;
        String filepattern(TempFolderPrefix);
        filepattern += _T("*.*");
-       String pattern = paths::GetParentPath(env_GetTempPath());
+       String pattern = paths::GetParentPath(env::GetTemporaryPath());
        pattern = paths::ConcatPath(pattern, filepattern);
        WIN32_FIND_DATA ff;
        HANDLE h;
index 2eb0040..3e12625 100644 (file)
@@ -55,7 +55,7 @@ bool VSSHelper::ReLinkVCProj(const String& strSavePath, String& sError)
 {
        const UINT nBufferSize = 1024;
 
-       String tempFile = env_GetTempFileName(env_GetTempPath(), _T("_LT"));
+       String tempFile = env::GetTemporaryFileName(env::GetTemporaryPath(), _T("_LT"));
        if (tempFile.empty())
        {
                LogErrorString(_T("CMainFrame::ReLinkVCProj() - couldn't get tempfile"));
index 9cb08e8..ff14209 100644 (file)
@@ -40,13 +40,13 @@ namespace
 
        TEST_F(EnvironmentTest, LoadRegistryFromFile)
        {
-               EXPECT_EQ(false, env_LoadRegistryFromFile(_T("nonexistfile.reg")));
+               EXPECT_EQ(false, env::LoadRegistryFromFile(_T("nonexistfile.reg")));
 
                system(
                        "reg add    HKCU\\Software\\Thingamahoochie\\test /v Path /t REG_EXPAND_SZ /d \"abc\" & "
                        "reg export HKCU\\Software\\Thingamahoochie\\test test.reg & "
                        "reg delete HKCU\\Software\\Thingamahoochie\\test /f");
-               EXPECT_EQ(true, env_LoadRegistryFromFile(_T("test.reg")));
+               EXPECT_EQ(true, env::LoadRegistryFromFile(_T("test.reg")));
                EXPECT_EQ(0, system("reg query HKCU\\Software\\Thingamahoochie\\test /v Path | findstr abc"));
                system("reg delete HKCU\\Software\\Thingamahoochie\\test /f");
                remove("test.reg");
@@ -54,11 +54,11 @@ namespace
 
        TEST_F(EnvironmentTest, SaveRegistry)
        {
-               EXPECT_EQ(false, env_SaveRegistryToFile(_T("nonexistfile.reg"), _T("Software\\Thingamahoochie\\tes")));
+               EXPECT_EQ(false, env::SaveRegistryToFile(_T("nonexistfile.reg"), _T("Software\\Thingamahoochie\\tes")));
 
                system("reg add    HKCU\\Software\\Thingamahoochie\\test /v Path /t REG_EXPAND_SZ /d \"abc\"");
                system("echo. > test2.reg");
-               EXPECT_EQ(true, env_SaveRegistryToFile(_T("test2.reg"), _T("Software\\Thingamahoochie\\test")));
+               EXPECT_EQ(true, env::SaveRegistryToFile(_T("test2.reg"), _T("Software\\Thingamahoochie\\test")));
                EXPECT_EQ(0, system("type test2.reg|findstr Path"));
                system("reg delete HKCU\\Software\\Thingamahoochie\\test /f");
                remove("test2.reg");
index b2cc004..6775eb5 100644 (file)
@@ -34,7 +34,7 @@ namespace
                        // before each test).
                        TCHAR temp[MAX_PATH] = {0};
                        GetModuleFileName(NULL, temp, MAX_PATH);
-                       env_SetProgPath(paths::GetPathOnly(temp) + _T("/../FileFilter"));
+                       env::SetProgPath(paths::GetPathOnly(temp) + _T("/../FileFilter"));
                        m_fileFilterHelper.LoadAllFileFilters();
                }
 
index 0133d84..a2a617c 100644 (file)
@@ -48,8 +48,8 @@ namespace
 
        TEST_F(PluginsTest, Unpack)
        {
-               String oldModulePath = env_GetProgPath();
-               env_SetProgPath(_T("c:/program files (x86)/winmerge"));
+               String oldModulePath = env::GetProgPath();
+               env::SetProgPath(_T("c:/program files (x86)/winmerge"));
                CAssureScriptsForThread asft;
                PackingInfo *iu = NULL;
                PrediffingInfo *ip = NULL;