Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5fbcb06

Browse files
author
Jim Puls
committed
Don't rewrite the same data if it hasn't changed
1 parent5d3643e commit5fbcb06

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎assetgen/AGCatalogParser.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ - (void)outputCode;
207207
NSString *className = [NSStringstringWithFormat:@"%@%@Catalog",self.classPrefix,self.catalogName];
208208
NSString *classNameH = [classNamestringByAppendingPathExtension:@"h"];
209209
NSString *classNameM = [classNamestringByAppendingPathExtension:@"m"];
210+
211+
NSURL *interfaceURL = [currentDirectoryURLByAppendingPathComponent:classNameH];
212+
NSURL *implementationURL = [currentDirectoryURLByAppendingPathComponent:classNameM];
210213

211214
[self.interfaceContentssortUsingComparator:^NSComparisonResult(id obj1,id obj2) {
212215
return [obj1compare:obj2];
@@ -217,11 +220,15 @@ - (void)outputCode;
217220

218221
NSString *interface = [NSStringstringWithFormat:@"//\n// This file is generated by objc-assetgen. Please do not edit.\n//\n\n#import <UIKit/UIKit.h>\n\n@interface%@ : NSObject\n\n%@\n@end\n", className, [self.interfaceContentscomponentsJoinedByString:@""]];
219222

220-
[interfacewriteToURL:[currentDirectoryURLByAppendingPathComponent:classNameH]atomically:YESencoding:NSUTF8StringEncodingerror:NULL];
223+
if (![interfaceisEqualToString:[NSStringstringWithContentsOfURL:interfaceURLencoding:NSUTF8StringEncodingerror:NULL]]) {
224+
[interfacewriteToURL:interfaceURLatomically:YESencoding:NSUTF8StringEncodingerror:NULL];
225+
}
221226

222227
NSString *implementation = [NSStringstringWithFormat:@"//\n// This file is generated by objc-assetgen. Please do not edit.\n//\n\n#import\"%@\"\n\n@implementation%@\n\n%@\n%@\n\n@end\n", classNameH, className,self.cacheMethodContents, [self.implementationContentscomponentsJoinedByString:@"\n"]];
223228

224-
[implementationwriteToURL:[currentDirectoryURLByAppendingPathComponent:classNameM]atomically:YESencoding:NSUTF8StringEncodingerror:NULL];
229+
if (![implementationisEqualToString:[NSStringstringWithContentsOfURL:implementationURLencoding:NSUTF8StringEncodingerror:NULL]]) {
230+
[implementationwriteToURL:implementationURLatomically:YESencoding:NSUTF8StringEncodingerror:NULL];
231+
}
225232

226233
NSLog(@"Wrote%@ to%@", className, currentDirectory);
227234
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp