Explorar o código

App Delegate: clean caches on launch

Felix Paul Kühne %!s(int64=11) %!d(string=hai) anos
pai
achega
a603b2ece0
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      Sources/VLCAppDelegate.m

+ 7 - 0
Sources/VLCAppDelegate.m

@@ -59,6 +59,13 @@
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
+    /* clean caches on launch (since those are used for wifi upload only) */
+    NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString* uploadDirPath = searchPaths[0];
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    if ([fileManager fileExistsAtPath:uploadDirPath])
+        [fileManager removeItemAtPath:uploadDirPath error:nil];
+
     // Init the HTTP Server
     self.uploadController = [[VLCHTTPUploaderController alloc] init];