Skip to content

Commit 27f610a

Browse files
committed
Cleaning up the previously generated .strings file before running genstrings, prevents inexistent keys from showing up in the generated files.
1 parent a09cba5 commit 27f610a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

SCStringsUtility/SCStringsController.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,12 @@ - (void)importProjectAtPath:(NSString *)path
224224
[fileParent sortUsingDescriptors:@[sortByLanguage]];
225225
}
226226

227+
NSString *stringsFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:stringsFileName];
228+
[[NSFileManager defaultManager] removeItemAtPath:stringsFilePath error:nil];
229+
227230
[self executeGenStringsAtPath:[self.project.filePath stringByDeletingLastPathComponent] withRoutine:genstringsRoutine positionalParameters:includePositionalParameters];
228-
SCReader *genstringsOutputReader = [[SCReader alloc] initWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:stringsFileName]];
231+
232+
SCReader *genstringsOutputReader = [[SCReader alloc] initWithPath:stringsFilePath];
229233
NSString *comment, *key, *translation;
230234
while([genstringsOutputReader getNextComment:&comment key:&key translation:&translation]) {
231235
[self.translationsDictionary setObject:[NSMutableDictionary dictionaryWithObject:comment forKey:kKeyComment] forKey:key];

0 commit comments

Comments
 (0)