Skip to content

Commit 9e64cce

Browse files
Merge pull request libretro#17678 from warmenhoven/warmenhoven/cloud-ignore
2 parents e7132c1 + 3943f5b commit 9e64cce

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

Diff for: tasks/task_cloudsync.c

+50-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ static void task_cloud_sync_build_current_manifest(task_cloud_sync_state_t *sync
418418

419419
file_list_sort_on_alt(sync_state->current_manifest);
420420
sync_state->phase = CLOUD_SYNC_PHASE_DIFF;
421-
RARCH_LOG(CSPFX "created in-memory manifest of current disk state\n");
421+
RARCH_LOG(CSPFX "created in-memory manifest of current disk state with %d files\n", sync_state->current_manifest->size);
422422
}
423423

424424
/**
@@ -869,6 +869,49 @@ static void task_cloud_sync_delete_server_file(task_cloud_sync_state_t *sync_sta
869869
}
870870
}
871871

872+
static void task_cloud_sync_maybe_ignore(task_cloud_sync_state_t *sync_state)
873+
{
874+
struct string_list *dirlist = task_cloud_sync_directory_map();
875+
int i;
876+
bool found;
877+
878+
if (sync_state->local_manifest)
879+
{
880+
for (found = false; !found && sync_state->local_idx < sync_state->local_manifest->size; )
881+
{
882+
struct item_file *local_file = &sync_state->local_manifest->list[sync_state->local_idx];
883+
const char *key = CS_FILE_KEY(local_file);
884+
for (i = 0; !found && i < dirlist->size; i++)
885+
found = string_starts_with(key, dirlist->elems[i].data);
886+
/* we have a record of doing a sync for this file but now no longer
887+
* wish to sync it. keep the record? might as well, in case the option
888+
* gets turned back on later. */
889+
if (!found)
890+
{
891+
task_cloud_sync_add_to_updated_manifest(sync_state, key, CS_FILE_HASH(local_file), false);
892+
sync_state->local_idx++;
893+
}
894+
}
895+
}
896+
897+
if (sync_state->server_manifest)
898+
{
899+
for (found = false; !found && sync_state->server_idx < sync_state->server_manifest->size; )
900+
{
901+
struct item_file *server_file = &sync_state->server_manifest->list[sync_state->server_idx];
902+
const char *key = CS_FILE_KEY(server_file);
903+
for (i = 0; !found && i < dirlist->size; i++)
904+
found = string_starts_with(key, dirlist->elems[i].data);
905+
/* must keep the server's manifest complete */
906+
if (!found)
907+
{
908+
task_cloud_sync_add_to_updated_manifest(sync_state, key, CS_FILE_HASH(server_file), true);
909+
sync_state->server_idx++;
910+
}
911+
}
912+
}
913+
}
914+
872915
static void task_cloud_sync_diff_next(task_cloud_sync_state_t *sync_state)
873916
{
874917
int server_local_key_cmp;
@@ -878,6 +921,12 @@ static void task_cloud_sync_diff_next(task_cloud_sync_state_t *sync_state)
878921
struct item_file *local_file = NULL;
879922
struct item_file *current_file = NULL;
880923

924+
/* Move past files that are deliberately not being sync'd. There would not be
925+
* any in the current state, but there may be in the server or local state.
926+
* If there are in the server state, make sure to leave them in the server's
927+
* manifest. */
928+
task_cloud_sync_maybe_ignore(sync_state);
929+
881930
if ( sync_state->server_manifest
882931
&& sync_state->server_idx < sync_state->server_manifest->size)
883932
server_file = &sync_state->server_manifest->list[sync_state->server_idx];

0 commit comments

Comments
 (0)