diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-02-23 09:26:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-23 09:26:09 -0500 |
commit | db012e5b74c1c432c94c708b8b3985c52a01b74b (patch) | |
tree | 046978345edd6ed117ae2fbe791cbb3b0fc00ae9 | |
parent | 2714845e068d05d0247bb317b1fc965100efa209 (diff) | |
parent | 61df343a71ca9a7f2a4da137ed01bbfb7d1c590b (diff) | |
download | sdl_ios-db012e5b74c1c432c94c708b8b3985c52a01b74b.tar.gz |
Merge pull request #873 from smartdevicelink/bugs/issue_872_too_few_logs
Fix SDLLogTargetFile bug
-rw-r--r-- | SmartDeviceLink/SDLLogTargetFile.m | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLLogTargetFile.m b/SmartDeviceLink/SDLLogTargetFile.m index f84185ebb..a7624cb88 100644 --- a/SmartDeviceLink/SDLLogTargetFile.m +++ b/SmartDeviceLink/SDLLogTargetFile.m @@ -111,9 +111,9 @@ NS_ASSUME_NONNULL_BEGIN NSArray<NSString *> *sortedLogFilePaths = [self sdl_sortedLogFilePaths]; // If we have more files now than the max, remove the oldest ones - NSUInteger filesToRemove = sortedLogFilePaths.count - maxFiles; - for (NSUInteger i = 0; i < filesToRemove; i++) { - NSString *path = [[self sdl_logDirectory] stringByAppendingPathComponent:sortedLogFilePaths[i]]; + NSInteger filesToRemove = (NSInteger)sortedLogFilePaths.count - (NSInteger)maxFiles; + for (NSInteger i = 0; i < filesToRemove; i++) { + NSString *path = [[self sdl_logDirectory] stringByAppendingPathComponent:sortedLogFilePaths[(NSUInteger)i]]; [[NSFileManager defaultManager] removeItemAtPath:path error:nil]; } } |