| 141 | |
| 142 | |
| 143 | bool FileOpsImpl::FileCopy |
| 144 | ( |
| 145 | const string _sourcefile, |
| 146 | const string _destfile |
| 147 | ) |
| 148 | { |
| 149 | |
| 150 | if (!FileExists(_sourcefile)) { |
| 151 | Log::Write(LogLevel_Warning, "Source File %s doesn't exist in FileCopy", _sourcefile.c_str()); |
| 152 | return false; |
| 153 | } |
| 154 | if (FileExists(_destfile)) { |
| 155 | Log::Write(LogLevel_Warning, "Destination File %s exists in FileCopy", _destfile.c_str()); |
| 156 | return false; |
| 157 | } |
| 158 | |
| 159 | /* make sure the Destination Folder Exists */ |
| 160 | if (!FolderExists(ozwdirname(_destfile))) { |
| 161 | Log::Write(LogLevel_Warning, "Destination Folder %s Doesn't Exist", ozwdirname(_destfile)); |
| 162 | return false; |
| 163 | } |
| 164 | wstring wSrcFileName(_sourcefile.begin(), _sourcefile.end()); |
| 165 | wstring wDstFileName(_destfile.begin(), _destfile.end()); |
| 166 | |
| 167 | if (CopyFile2(wSrcFileName.c_str(), wDstFileName.c_str(), FALSE) == 0) { |
| 168 | Log::Write(LogLevel_Warning, "CopyFile Failed %s - %s", _sourcefile.c_str(), _destfile.c_str()); |
| 169 | return false; |
| 170 | } |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | bool FileOpsImpl::FolderCreate |
| 175 | ( |