summaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/TemporaryDirectory.h46
-rw-r--r--lib/common/Utils.cpp28
-rw-r--r--lib/common/Utils.h2
3 files changed, 30 insertions, 46 deletions
diff --git a/lib/common/TemporaryDirectory.h b/lib/common/TemporaryDirectory.h
deleted file mode 100644
index 9d52ecd9..00000000
--- a/lib/common/TemporaryDirectory.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// --------------------------------------------------------------------------
-//
-// File
-// Name: TemporaryDirectory.h
-// Purpose: Location of temporary directory
-// Created: 2003/10/13
-//
-// --------------------------------------------------------------------------
-
-#ifndef TEMPORARYDIRECTORY__H
-#define TEMPORARYDIRECTORY__H
-
-#include <string>
-
-#ifdef WIN32
- #include <windows.h>
-#endif
-
-// Prefix name with Box to avoid clashing with OS API names
-std::string BoxGetTemporaryDirectoryName()
-{
-#ifdef WIN32
- // http://msdn.microsoft.com/library/default.asp?
- // url=/library/en-us/fileio/fs/creating_and_using_a_temporary_file.asp
-
- DWORD dwRetVal;
- char lpPathBuffer[1024];
- DWORD dwBufSize = sizeof(lpPathBuffer);
-
- // Get the temp path.
- dwRetVal = GetTempPath(dwBufSize, // length of the buffer
- lpPathBuffer); // buffer for path
- if (dwRetVal > dwBufSize)
- {
- THROW_EXCEPTION(CommonException, TempDirPathTooLong)
- }
-
- return std::string(lpPathBuffer);
-#elif defined TEMP_DIRECTORY_NAME
- return std::string(TEMP_DIRECTORY_NAME);
-#else
- #error non-static temporary directory names not supported yet
-#endif
-}
-
-#endif // TEMPORARYDIRECTORY__H
diff --git a/lib/common/Utils.cpp b/lib/common/Utils.cpp
index 6afafe84..4f44ce0a 100644
--- a/lib/common/Utils.cpp
+++ b/lib/common/Utils.cpp
@@ -335,3 +335,31 @@ std::string FormatUsageLineStart(const std::string& rName,
return result.str();
}
+
+std::string BoxGetTemporaryDirectoryName()
+{
+#ifdef WIN32
+ // http://msdn.microsoft.com/library/default.asp?
+ // url=/library/en-us/fileio/fs/creating_and_using_a_temporary_file.asp
+
+ DWORD dwRetVal;
+ char lpPathBuffer[1024];
+ DWORD dwBufSize = sizeof(lpPathBuffer);
+
+ // Get the temp path.
+ dwRetVal = GetTempPath(dwBufSize, // length of the buffer
+ lpPathBuffer); // buffer for path
+ if (dwRetVal > dwBufSize)
+ {
+ THROW_EXCEPTION(CommonException, TempDirPathTooLong)
+ }
+
+ return std::string(lpPathBuffer);
+#elif defined TEMP_DIRECTORY_NAME
+ return std::string(TEMP_DIRECTORY_NAME);
+#else
+ #error non-static temporary directory names not supported yet
+#endif
+}
+
+
diff --git a/lib/common/Utils.h b/lib/common/Utils.h
index 8d98a520..3134245a 100644
--- a/lib/common/Utils.h
+++ b/lib/common/Utils.h
@@ -39,6 +39,8 @@ std::string FormatUsageBar(int64_t Blocks, int64_t Bytes, int64_t Max,
std::string FormatUsageLineStart(const std::string& rName,
bool MachineReadable);
+std::string BoxGetTemporaryDirectoryName();
+
#include "MemLeakFindOff.h"
#endif // UTILS__H