| 3371 | } |
| 3372 | |
| 3373 | BFP_EXPORT void BFP_CALLTYPE BfpFile_Copy(const char* oldName, const char* newName, BfpFileCopyKind copyKind, BfpFileResult* outResult) |
| 3374 | { |
| 3375 | if (copyKind == BfpFileCopyKind_IfNewer) |
| 3376 | { |
| 3377 | BfpTimeStamp fromTime = 0; |
| 3378 | GetFileInfo(oldName, &fromTime, NULL); |
| 3379 | BfpTimeStamp toTime = 0; |
| 3380 | GetFileInfo(newName, &toTime, NULL); |
| 3381 | |
| 3382 | if ((toTime != 0) && (toTime >= fromTime)) |
| 3383 | { |
| 3384 | OUTRESULT(BfpFileResult_Ok); |
| 3385 | return; |
| 3386 | } |
| 3387 | } |
| 3388 | |
| 3389 | UTF16String wOldPath = UTF8Decode(oldName); |
| 3390 | UTF16String wNewPath = UTF8Decode(newName); |
| 3391 | if (!::CopyFileW(wOldPath.c_str(), wNewPath.c_str(), copyKind == BfpFileCopyKind_IfNotExists)) |
| 3392 | { |
| 3393 | switch (::GetLastError()) |
| 3394 | { |
| 3395 | case ERROR_ALREADY_EXISTS: |
| 3396 | OUTRESULT(BfpFileResult_AlreadyExists); |
| 3397 | break; |
| 3398 | case ERROR_PATH_NOT_FOUND: |
| 3399 | OUTRESULT(BfpFileResult_NotFound); |
| 3400 | break; |
| 3401 | default: |
| 3402 | OUTRESULT(BfpFileResult_UnknownError); |
| 3403 | break; |
| 3404 | } |
| 3405 | } |
| 3406 | else |
| 3407 | { |
| 3408 | OUTRESULT(BfpFileResult_Ok); |
| 3409 | } |
| 3410 | } |
| 3411 | |
| 3412 | BFP_EXPORT void BFP_CALLTYPE BfpFile_Rename(const char* oldName, const char* newName, BfpFileResult* outResult) |
| 3413 | { |
no test coverage detected