mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 02:43:03 +00:00
cloud sync: small bug fixes around handling deleted files (#17236)
This commit is contained in:
parent
3bdc71c20f
commit
7b29062e96
@ -159,10 +159,10 @@ static bool icloud_update(const char *p, RFILE *rfile, cloud_sync_complete_handl
|
||||
|
||||
static bool icloud_delete(const char *p, cloud_sync_complete_handler_t cb, void *user_data)
|
||||
{
|
||||
char *path = strdup(p);
|
||||
NSString *path = [NSString stringWithUTF8String:p];
|
||||
NSPredicate *pred = [NSComparisonPredicate
|
||||
predicateWithLeftExpression:[NSExpression expressionForKeyPath:@"path"]
|
||||
rightExpression:[NSExpression expressionForConstantValue:[NSString stringWithUTF8String:path]]
|
||||
rightExpression:[NSExpression expressionForConstantValue:path]
|
||||
modifier:NSDirectPredicateModifier
|
||||
type:NSEqualToPredicateOperatorType
|
||||
options:0];
|
||||
@ -170,18 +170,17 @@ static bool icloud_delete(const char *p, cloud_sync_complete_handler_t cb, void
|
||||
[CKContainer.defaultContainer.privateCloudDatabase performQuery:query
|
||||
inZoneWithID:nil
|
||||
completionHandler:^(NSArray<CKRecord *> * _Nullable results, NSError * _Nullable error) {
|
||||
RARCH_DBG("[iCloud] deleting %d records for %s\n", [results count], path);
|
||||
RARCH_DBG("[iCloud] deleting %d records for %s\n", [results count], [path UTF8String]);
|
||||
for (CKRecord *record in results)
|
||||
{
|
||||
[CKContainer.defaultContainer.privateCloudDatabase deleteRecordWithID:record.recordID
|
||||
completionHandler:^(CKRecordID * _Nullable recordID, NSError * _Nullable error) {
|
||||
RARCH_DBG("[iCloud] delete callback for %s %s\n", path, error == nil ? "succeeded" : "failed");
|
||||
RARCH_DBG("[iCloud] delete callback for %s %s\n", [path UTF8String], error == nil ? "succeeded" : "failed");
|
||||
if (error)
|
||||
RARCH_DBG("[iCloud] error: %s\n", [[error debugDescription] UTF8String]);
|
||||
}];
|
||||
}
|
||||
cb(user_data, path, error == nil, NULL);
|
||||
free(path);
|
||||
cb(user_data, [path UTF8String], error == nil, NULL);
|
||||
}];
|
||||
return true;
|
||||
}
|
||||
|
@ -799,7 +799,10 @@ static void task_cloud_sync_check_server_current(task_cloud_sync_state_t *sync_s
|
||||
else if (!CS_FILE_DELETED(server_file))
|
||||
task_cloud_sync_fetch_server_file(sync_state);
|
||||
else
|
||||
{
|
||||
task_cloud_sync_delete_current_file(sync_state);
|
||||
task_cloud_sync_add_to_updated_manifest(sync_state, CS_FILE_KEY(server_file), CS_FILE_HASH(server_file), false);
|
||||
}
|
||||
}
|
||||
|
||||
static void task_cloud_sync_delete_cb(void *user_data, const char *path, bool success, RFILE *file)
|
||||
@ -952,10 +955,10 @@ static void task_cloud_sync_diff_next(task_cloud_sync_state_t *sync_state)
|
||||
/* the file has been deleted locally */
|
||||
if (!CS_FILE_DELETED(server_file))
|
||||
{
|
||||
if (CS_FILE_DELETED(current_file))
|
||||
if (CS_FILE_DELETED(local_file))
|
||||
/* previously saw the delete, now it's resurrected */
|
||||
task_cloud_sync_fetch_server_file(sync_state);
|
||||
else if (string_is_equal(CS_FILE_HASH(server_file), CS_FILE_HASH(current_file)))
|
||||
else if (string_is_equal(CS_FILE_HASH(server_file), CS_FILE_HASH(local_file)))
|
||||
/* server didn't change, delete from the server */
|
||||
task_cloud_sync_delete_server_file(sync_state);
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user