Skip to content

Commit

Permalink
Cleaning up the previously generated .strings file before running gen…
Browse files Browse the repository at this point in the history
…strings, prevents inexistent keys from showing up in the generated files.
  • Loading branch information
stefanceriu committed Jan 28, 2016
1 parent a09cba5 commit 27f610a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SCStringsUtility/SCStringsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,12 @@ - (void)importProjectAtPath:(NSString *)path
[fileParent sortUsingDescriptors:@[sortByLanguage]];
}

NSString *stringsFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:stringsFileName];
[[NSFileManager defaultManager] removeItemAtPath:stringsFilePath error:nil];

[self executeGenStringsAtPath:[self.project.filePath stringByDeletingLastPathComponent] withRoutine:genstringsRoutine positionalParameters:includePositionalParameters];
SCReader *genstringsOutputReader = [[SCReader alloc] initWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:stringsFileName]];

SCReader *genstringsOutputReader = [[SCReader alloc] initWithPath:stringsFilePath];
NSString *comment, *key, *translation;
while([genstringsOutputReader getNextComment:&comment key:&key translation:&translation]) {
[self.translationsDictionary setObject:[NSMutableDictionary dictionaryWithObject:comment forKey:kKeyComment] forKey:key];
Expand Down

0 comments on commit 27f610a

Please sign in to comment.