File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
7070- (void )applicationWillTerminate : (NSNotification *)aNotification {
7171 DDLogInfo (@" AppBox Terminated." );
7272 [self saveCoreDataChanges ];
73+ [self deleteTemporaryFiles ];
7374}
7475
7576- (BOOL )applicationShouldTerminateAfterLastWindowClosed : (NSApplication *)sender {
@@ -325,4 +326,12 @@ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sende
325326 return NSTerminateNow;
326327}
327328
329+ // MARK: - Other helpers
330+ - (void )deleteTemporaryFiles {
331+ NSArray * tmpDirectory = [[NSFileManager defaultManager ] contentsOfDirectoryAtPath: NSTemporaryDirectory () error: NULL ];
332+ for (NSString *file in tmpDirectory) {
333+ [[NSFileManager defaultManager ] removeItemAtPath: [NSString stringWithFormat: @" %@%@ " , NSTemporaryDirectory (), file] error: NULL ];
334+ }
335+ }
336+
328337@end
You can’t perform that action at this time.
0 commit comments