| 169 | } |
| 170 | |
| 171 | bool BeLibFile::Init(const StringImpl& filePath, bool moveFile) |
| 172 | { |
| 173 | bool isInitialized = false; |
| 174 | |
| 175 | if (FileExists(filePath)) |
| 176 | { |
| 177 | String altName; |
| 178 | if (moveFile) |
| 179 | { |
| 180 | altName = filePath + "_"; |
| 181 | if (!::MoveFileA(filePath.c_str(), altName.c_str())) |
| 182 | { |
| 183 | ::DeleteFileA(altName.c_str()); |
| 184 | if (!::MoveFileA(filePath.c_str(), altName.c_str())) |
| 185 | { |
| 186 | mFilePath = filePath; |
| 187 | return false; |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | else |
| 192 | altName = filePath; |
| 193 | mOldFilePath = altName; |
| 194 | |
| 195 | if (!mOldFileStream.Open(altName, "rb")) |
| 196 | return false; |
| 197 | |
| 198 | if (!ReadLib()) |
| 199 | return false; |
| 200 | } |
| 201 | |
| 202 | String newLibName = filePath; |
| 203 | mFilePath = newLibName; |
| 204 | |
| 205 | return true; |
| 206 | } |
| 207 | |
| 208 | bool BeLibFile::Finish() |
| 209 | { |