-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdatepathes.cpp
60 lines (45 loc) · 1.13 KB
/
updatepathes.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "stdafx.h"
#include "updatepathes.h"
#include "constants.h"
//#include <boost/filesystem.hpp>
using namespace Update;
CUpdatePathes::CUpdatePathes(void)
{
uint32_t numOfChars = 0;
char updateDir[1024];
std::string updateDirShort;
/*
boost::filesystem::path p = boost::filesystem::temp_directory_path();
std::string str_path = p.string();
#if defined( _MSC_VER )
str_path += "\\";
#else
str_path += "/";
#endif
m_updateDir = str_path;
*/
#if defined( _MSC_VER )
char* tempDir = getenv("TMP");
if(tempDir == NULL)
tempDir = getenv("TEMP");
if(tempDir == NULL)
tempDir = getenv("SystemDrive");
#else
char* tempDir = getenv("TMPDIR");
#endif
updateDirShort = tempDir;
memset(updateDir, 0, sizeof(updateDir));
#if defined( _MSC_VER )
updateDirShort += "\\";
numOfChars = GetLongPathName(updateDirShort.c_str(), (LPSTR)updateDir, sizeof(updateDir) - 1);
m_updateDir = updateDir;
#else
m_updateDir = updateDirShort;
#endif
m_updateIniFilePath += m_updateDir;
m_updateIniFilePath += UPDATE_INI_FILENAME;
m_updateSetupFilePath = m_updateDir;
}
CUpdatePathes::~CUpdatePathes(void)
{
}