Changeset 534
- Timestamp:
- 11/13/2008 9:35:24 AM (5 years ago)
- Location:
- branches/eraser6/Installer/Bootstrapper
- Files:
-
- 2 edited
-
Bootstrapper.cpp (modified) (2 diffs)
-
Bootstrapper.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Installer/Bootstrapper/Bootstrapper.cpp
r532 r534 80 80 }; 81 81 82 /// Creates a temporary directory with the given name. The directory and files in it 83 /// are deleted when this object is destroyed. 84 class TempDir 85 { 86 public: 87 /// Constructor. 88 /// 89 /// \param[in] dirName The path to the directory. This directory will be created. 90 TempDir(std::wstring dirName) 91 : DirName(dirName) 92 { 93 if (!CreateDirectoryW(dirName.c_str(), NULL)) 94 throw GetErrorMessage(GetLastError()); 95 } 96 97 ~TempDir() 98 { 99 RemoveDirectoryW(DirName.c_str()); 100 } 101 102 private: 103 std::wstring DirName; 104 }; 105 106 void ExtractTempFiles() 107 { 108 //Get the path to the temporary folder 109 wchar_t tempPath[MAX_PATH]; 110 DWORD result = GetTempPathW(sizeof(tempPath) / sizeof(tempPath[0]), tempPath); 111 if (!result) 112 throw GetErrorMessage(GetLastError()); 113 114 std::wstring tempDir(tempPath, result); 115 if (std::wstring(L"\\/").find(tempDir[tempDir.length() - 1]) == std::wstring::npos) 116 tempDir += L"\\"; 117 tempDir += L"eraserInstallBootstrapper\\"; 118 TempDir dir(tempDir); 82 void ExtractTempFiles(std::wstring pathToExtract) 83 { 84 if (std::wstring(L"\\/").find(pathToExtract[pathToExtract.length() - 1])) 85 pathToExtract += L"\\"; 119 86 120 87 //Open the file … … 172 139 wchar_t fileName[MAX_PATH]; 173 140 mbstowcs(fileName, f->Name, sizeof(fileName) / sizeof(fileName[0])); 174 HANDLE destFile = CreateFileW(( tempDir+ fileName).c_str(), GENERIC_WRITE, 0,141 HANDLE destFile = CreateFileW((pathToExtract + fileName).c_str(), GENERIC_WRITE, 0, 175 142 NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 176 143 if (destFile == INVALID_HANDLE_VALUE) -
branches/eraser6/Installer/Bootstrapper/Bootstrapper.h
r532 r534 41 41 42 42 /// Extracts the setup files to the users' temporary folder. 43 void ExtractTempFiles(); 43 /// 44 /// \param[in] pathToExtract The path to extract the temporary files to. 45 void ExtractTempFiles(std::wstring pathToExtract); 44 46 45 47 /// Checks for the presence of the .NET Framework on the client computer.
Note: See TracChangeset
for help on using the changeset viewer.
