Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage migration old file still exists #117

Merged
merged 5 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Castle/Internal/CASEventStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ @implementation CASEventStorage

+ (NSArray *)storedQueue
{
// Migrate storage if neccessary
[self.class migrateStorageIfNeccessary];

// Read queue from file
NSArray *queue = [self readQueueFromFile:self.storagePath];
if (queue == nil) {
Expand All @@ -35,8 +32,12 @@ + (NSArray *)storedQueue

+ (void)persistQueue:(NSArray *)queue
{
// Create storage path if neccessary
[self.class createStoragePathIfNeccessary];

// Migrate storage if neccessary
[self.class migrateStorageIfNeccessary];

BOOL persisted = NO;
if (@available(iOS 11.0, *)) {
NSError *error = nil;
Expand Down Expand Up @@ -110,6 +111,7 @@ + (void)migrateStorageIfNeccessary
{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *oldStoragePath = [self.class oldStoragePath];

if ([fileManager fileExistsAtPath:oldStoragePath isDirectory:NULL]) {
// Create new storage path if neccessary
[self.class createStoragePathIfNeccessary];
Expand Down