Fix order of operations in SAE setup.

pull/1/head
Matthew Chen 7 years ago
parent 03d1165947
commit 791743a5f0

@ -55,12 +55,14 @@ NS_ASSUME_NONNULL_BEGIN
sharedDataFilePath:(NSString *)newFilePath
exceptionName:(NSString *)exceptionName
{
DDLogInfo(@"%@ Moving file or directory from: %@ to: %@", self.logTag, oldFilePath, newFilePath);
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:oldFilePath]) {
return;
}
if ([fileManager fileExistsAtPath:newFilePath]) {
OWSFail(@"%@ Can't move file or directory from %@ to %@; destination already exists.",
OWSFail(@"%@ Can't move file or directory from: %@ to: %@; destination already exists.",
self.logTag,
oldFilePath,
newFilePath);
@ -73,7 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
BOOL success = [fileManager moveItemAtPath:oldFilePath toPath:newFilePath error:&error];
if (!success || error) {
NSString *errorDescription =
[NSString stringWithFormat:@"%@ Could not move file or directory from %@ to %@, error: %@",
[NSString stringWithFormat:@"%@ Could not move file or directory from: %@ to: %@, error: %@",
self.logTag,
oldFilePath,
newFilePath,
@ -81,12 +83,12 @@ NS_ASSUME_NONNULL_BEGIN
OWSFail(@"%@", errorDescription);
[NSException raise:exceptionName format:@"%@", errorDescription];
}
DDLogInfo(@"%@ Moving file or directory from %@ to %@ in: %f",
self.logTag,
oldFilePath,
newFilePath,
fabs([startDate timeIntervalSinceNow]));
DDLogInfo(@"%@ Moved file or directory from: %@ to: %@ in: %f",
self.logTag,
oldFilePath,
newFilePath,
fabs([startDate timeIntervalSinceNow]));
}
+ (BOOL)ensureDirectoryExists:(NSString *)dirPath
@ -98,6 +100,8 @@ NS_ASSUME_NONNULL_BEGIN
return YES;
} else {
DDLogInfo(@"%@ Creating directory at: %@", self.logTag, dirPath);
NSError *error = nil;
[[NSFileManager defaultManager] createDirectoryAtPath:dirPath
withIntermediateDirectories:YES

@ -39,12 +39,6 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
// We don't need to use DeviceSleepManager in the SAE.
AppSetup.setupEnvironment({
return NoopCallMessageHandler()
}) {
return NoopNotificationsManager()
}
// TODO:
// [UIUtil applySignalAppearence];
@ -71,6 +65,12 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
return
}
AppSetup.setupEnvironment({
return NoopCallMessageHandler()
}) {
return NoopNotificationsManager()
}
// performUpdateCheck must be invoked after Environment has been initialized because
// upgrade process may depend on Environment.
VersionMigrations.performUpdateCheck()

Loading…
Cancel
Save