You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.5 KiB
63 lines
1.5 KiB
4 years ago
|
//
|
||
|
// TFSandBoxHelper.m
|
||
|
// TFReader
|
||
|
//
|
||
|
// Created by 谢腾飞 on 2020/12/10.
|
||
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TFSandBoxHelper.h"
|
||
|
|
||
|
@implementation TFSandBoxHelper
|
||
|
|
||
|
+ (NSString *)homePath
|
||
|
{
|
||
|
return NSHomeDirectory();
|
||
|
}
|
||
|
|
||
|
+ (NSString *)appPath
|
||
|
{
|
||
|
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, NSUserDomainMask, YES);
|
||
|
return [paths objectOrNilAtIndex:0];
|
||
|
}
|
||
|
|
||
|
+ (NSString *)docPath
|
||
|
{
|
||
|
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||
|
return [paths objectOrNilAtIndex:0];
|
||
|
}
|
||
|
|
||
|
+ (NSString *)libPrefPath
|
||
|
{
|
||
|
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
|
||
|
return [[paths objectOrNilAtIndex:0] stringByAppendingFormat:@"/Preferences"];
|
||
|
}
|
||
|
|
||
|
+ (NSString *)libCachePath
|
||
|
{
|
||
|
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
|
||
|
return [[paths objectOrNilAtIndex:0] stringByAppendingFormat:@"/Caches"];
|
||
|
}
|
||
|
|
||
|
+ (NSString *)tmpPath
|
||
|
{
|
||
|
return [NSHomeDirectory() stringByAppendingFormat:@"/tmp"];
|
||
|
}
|
||
|
|
||
|
+ (NSString *)iapReceiptPath
|
||
|
{
|
||
|
NSString *path = [[self libPrefPath] stringByAppendingFormat:@"/EACEF35FE363A75A"];
|
||
|
[self hasLive:path];
|
||
|
return path;
|
||
|
}
|
||
|
|
||
|
+ (BOOL)hasLive:(NSString *)path
|
||
|
{
|
||
|
if (NO == [[NSFileManager defaultManager] fileExistsAtPath:path]) {
|
||
|
return [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:NULL];
|
||
|
}
|
||
|
return YES;
|
||
|
}
|
||
|
|
||
|
@end
|