|
@@ -73,7 +73,7 @@
|
|
|
BOOL isDir = NO;
|
|
|
[NSFileManager.defaultManager fileExistsAtPath:filePath isDirectory:&isDir];
|
|
|
if (isDir) {
|
|
|
- XCThemeSpec *theme = [[XCThemeSpec alloc] initWithThemeId:filePath];
|
|
|
+ XCThemeSpec *theme = [[XCThemeSpec alloc] initWithThemeId:file];
|
|
|
if (theme) {
|
|
|
XCThemeSpecModel *specModel = [[XCThemeSpecModel alloc] initWithWrappedObject:theme];
|
|
|
[specs addObject:specModel];
|
|
@@ -123,6 +123,16 @@
|
|
|
}
|
|
|
|
|
|
NSString *rootPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
|
|
|
+ NSString *themeResourcesPath = [rootPath stringByAppendingString:@"/ThemeResources"];
|
|
|
+ BOOL isDirectory;
|
|
|
+ if ([NSFileManager.defaultManager fileExistsAtPath:themeResourcesPath isDirectory:&isDirectory]) {
|
|
|
+ if (!isDirectory) {
|
|
|
+ [NSFileManager.defaultManager removeItemAtPath:themeResourcesPath error:nil];
|
|
|
+ [NSFileManager.defaultManager createDirectoryAtPath:themeResourcesPath withIntermediateDirectories:YES attributes:nil error:nil];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ [NSFileManager.defaultManager createDirectoryAtPath:themeResourcesPath withIntermediateDirectories:YES attributes:nil error:nil];
|
|
|
+ }
|
|
|
NSString *downloadTHMPath = [rootPath stringByAppendingFormat:@"/ThemeResources/%@.thm", themeId];
|
|
|
NSString *extractPath = [rootPath stringByAppendingFormat:@"/ThemeResources/%@", themeId];
|
|
|
self.downloadBlock(themeId, downloadTHMPath, ^(BOOL success, NSString * _Nonnull reason) {
|