PLVDownloadPathManager
Objective-C
@interface PLVDownloadPathManager : NSObject
Swift
class PLVDownloadPathManager : NSObject
下载路径管理器(单例类)
-
当前用户Id(可通过 setupDownloadViewerId: 配置)
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull viewerId;Swift
var viewerId: String { get } -
下载信息数据库的总目录
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull databaseHomePath;Swift
var databaseHomePath: String { get } -
当前用户数据库文件的路径
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull databaseViewerFilePath;Swift
var databaseViewerFilePath: String { get } -
下载文件存放的总目录
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull fileCacheHomePath;Swift
var fileCacheHomePath: String { get } -
下载文件存放的用户目录
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull fileCacheViewerPath;Swift
var fileCacheViewerPath: String { get }
-
当前用户的云课堂回放路径
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull viewerPlaybackPath;Swift
var viewerPlaybackPath: String { get }
-
获取单例类
Declaration
Objective-C
+ (nonnull instancetype)shareManager;Swift
class func share() -> Self -
配置用户Id(不同用户的下载文件将分开存放管理;不配置该值,下载模块将无法使用;重复配置该Id,将切换数据库及下载文件路径)
Declaration
Objective-C
- (void)setupDownloadViewerId:(nonnull NSString *)viewerId;Swift
func setupDownloadViewerId(_ viewerId: String)
-
某个回放相关文件路径
Declaration
Objective-C
- (nonnull NSString *)playbackFileIdPath:(nonnull NSString *)fileId;Swift
func playbackFileIdPath(_ fileId: String) -> String -
某个回放的视频文件路径(读取后需按分辨率,找到对应文件)
Declaration
Objective-C
- (nonnull NSString *)playbackFileIdVideoPath:(nonnull NSString *)fileId;Swift
func playbackFileIdVideoPath(_ fileId: String) -> String -
某个回放的PPT文件路径
Declaration
Objective-C
- (nonnull NSString *)playbackFileIdPPTPath:(nonnull NSString *)fileId;Swift
func playbackFileIdPPTPath(_ fileId: String) -> String -
某个回放的Js文件路径
Declaration
Objective-C
- (nonnull NSString *)playbackFileIdJsPath:(nonnull NSString *)fileId;Swift
func playbackFileIdJsPath(_ fileId: String) -> String
-
获取路径文件大小
Declaration
Objective-C
- (unsigned long long)fileSizeForPath:(nonnull NSString *)path;Swift
func fileSize(forPath path: String) -> UInt64 -
检查路径已存在(若不存在,不会自动创建)
Declaration
Objective-C
- (BOOL)checkPathExsit:(nonnull NSString *)path;Swift
func checkPathExsit(_ path: String) -> Bool -
确认文件夹已存在(若不存在,将自动创建文件夹)
Declaration
Objective-C
- (void)ensureFolderExsit:(nonnull NSString *)folderPath;Swift
func ensureFolderExsit(_ folderPath: String) -
移除文件
Declaration
Objective-C
- (NSError *_Nullable)removeFileWithPath:(nonnull NSString *)filePath;Swift
func removeFile(withPath filePath: String) -> (any Error)? -
获取目标路径下,全部文件(不获取文件夹)
Declaration
Objective-C
- (nonnull NSArray<NSString *> *)getAllFileAtFolderPath: (nonnull NSString *)folderPath;Swift
func getAllFile(atFolderPath folderPath: String) -> [String] -
获取目标路径下,文件名包含特定字符的文件数组(不获取文件夹)
Declaration
Objective-C
- (nonnull NSArray<NSString *> *) findFileAtFolderPath:(nonnull NSString *)folderPath stringInFileName:(nonnull NSString *)string;Swift
func findFile(atFolderPath folderPath: String, stringInFileName string: String) -> [String]
-
添加一个Block接收 用户Id改变事件 (与上方属性Block事件,相互独立)
Declaration
Objective-C
- (void)addViewerIdChangeBlock:(nonnull PLVDownloadViewerIdChangeBlock)block key:(nonnull NSString *)blockKey;Swift
func addViewerIdChange(_ block: @escaping PLVDownloadViewerIdChangeBlock, key blockKey: String)Parameters
block事件回调
blockKey回调Key(不同调用方,以此字符串来区分注册)
-
移除一个接收方 不再接收用户Id改变事件
Declaration
Objective-C
- (void)removeViewerIdChangeWithKey:(nonnull NSString *)blockKey;Swift
func removeViewerIdChange(withKey blockKey: String)Parameters
blockKey接收方,在添加事件接收时所填Key
View on GitHub
PLVDownloadPathManager Class Reference