소스 검색

【功能】主题下载位置移至/Library/Cache

xcbosa mbp16 1 년 전
부모
커밋
317e8e326d
2개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 2
      XCTheme/Classes/Impl/XCThemeService.m
  2. 1 1
      XCTheme/Classes/Impl/XCThemeSpec.swift

+ 2 - 2
XCTheme/Classes/Impl/XCThemeService.m

@@ -64,7 +64,7 @@
 }
 }
 
 
 - (NSArray<XCThemeSpecModel *> *)fetchDownloadedSpecs {
 - (NSArray<XCThemeSpecModel *> *)fetchDownloadedSpecs {
-    NSString *documentsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true).firstObject;
+    NSString *documentsPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, true).firstObject;
     NSString *path = [documentsPath stringByAppendingString:@"/ThemeResources"];
     NSString *path = [documentsPath stringByAppendingString:@"/ThemeResources"];
     NSArray *items = [NSFileManager.defaultManager contentsOfDirectoryAtPath:path error:nil];
     NSArray *items = [NSFileManager.defaultManager contentsOfDirectoryAtPath:path error:nil];
     NSMutableArray<XCThemeSpecModel *> *specs = [NSMutableArray new];
     NSMutableArray<XCThemeSpecModel *> *specs = [NSMutableArray new];
@@ -122,7 +122,7 @@
         @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"downloadBlock not specified" userInfo:nil];
         @throw [NSException exceptionWithName:NSInvalidArgumentException reason:@"downloadBlock not specified" userInfo:nil];
     }
     }
     
     
-    NSString *rootPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
+    NSString *rootPath = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).firstObject;
     NSString *themeResourcesPath = [rootPath stringByAppendingString:@"/ThemeResources"];
     NSString *themeResourcesPath = [rootPath stringByAppendingString:@"/ThemeResources"];
     BOOL isDirectory;
     BOOL isDirectory;
     if ([NSFileManager.defaultManager fileExistsAtPath:themeResourcesPath isDirectory:&isDirectory]) {
     if ([NSFileManager.defaultManager fileExistsAtPath:themeResourcesPath isDirectory:&isDirectory]) {

+ 1 - 1
XCTheme/Classes/Impl/XCThemeSpec.swift

@@ -53,7 +53,7 @@ public class XCThemeSpec: NSObject {
     }
     }
     
     
     public var themeRootPath: String {
     public var themeRootPath: String {
-        let searchPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first ?? ""
+        let searchPath = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first ?? ""
         let documentPath = searchPath + "/ThemeResources/\(themeId)"
         let documentPath = searchPath + "/ThemeResources/\(themeId)"
         let isDir = UnsafeMutablePointer<ObjCBool>.allocate(capacity: 1)
         let isDir = UnsafeMutablePointer<ObjCBool>.allocate(capacity: 1)
         defer {
         defer {