2727
2828@implementation FCFontAssetInstaller
2929
30- - (instancetype ) initWithFontPath : (NSString *)path
30+ - (BOOL ) validateFontPath : (NSString *)fontPath error : ( NSError **) error
3131{
32- self = [super init ];
33- if (self != nil )
34- {
35- ASSIGN (_fontPath, path);
36- }
37- return self;
38- }
39-
40- - (instancetype ) init
41- {
42- return [self initWithFontPath: nil ];
43- }
44-
45- - (BOOL ) validateFontError : (NSError **)error
46- {
47- if (_fontPath == nil )
32+ if (fontPath == nil )
4833 {
4934 if (error != NULL )
5035 {
@@ -58,7 +43,7 @@ - (BOOL) validateFontError: (NSError **)error
5843 }
5944
6045 // Check if file exists
61- if (![[NSFileManager defaultManager ] fileExistsAtPath: _fontPath ])
46+ if (![[NSFileManager defaultManager ] fileExistsAtPath: fontPath ])
6247 {
6348 if (error != NULL )
6449 {
@@ -72,7 +57,7 @@ - (BOOL) validateFontError: (NSError **)error
7257 }
7358
7459 // Basic validation - check file size and magic bytes
75- NSData *fontData = [NSData dataWithContentsOfFile: _fontPath ];
60+ NSData *fontData = [NSData dataWithContentsOfFile: fontPath ];
7661 if (fontData == nil || [fontData length ] < 12 )
7762 {
7863 if (error != NULL )
@@ -113,9 +98,9 @@ - (BOOL) validateFontError: (NSError **)error
11398 return NO ;
11499}
115100
116- - (BOOL ) installFontError : (NSError **)error
101+ - (BOOL ) installFontPath : ( NSString *) fontPath error : (NSError **)error
117102{
118- if (_fontPath == nil )
103+ if (fontPath == nil )
119104 {
120105 if (error != NULL )
121106 {
@@ -128,7 +113,7 @@ - (BOOL) installFontError: (NSError **)error
128113 return NO ;
129114 }
130115
131- NSString *filename = [_fontPath lastPathComponent ];
116+ NSString *filename = [fontPath lastPathComponent ];
132117 NSString *destinationDir;
133118
134119 // Determine installation directory based on options
@@ -181,7 +166,7 @@ - (BOOL) installFontError: (NSError **)error
181166 [[NSFileManager defaultManager ] removeItemAtPath: destinationPath error: nil ];
182167 }
183168
184- if (![[NSFileManager defaultManager ] copyItemAtPath: _fontPath
169+ if (![[NSFileManager defaultManager ] copyItemAtPath: fontPath
185170 toPath: destinationPath
186171 error: ©Error])
187172 {
0 commit comments