1 |
efrain |
1 |
// Copyright 2019 Google
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
|
|
|
15 |
#import <Foundation/Foundation.h>
|
|
|
16 |
|
|
|
17 |
@class FIRCLSInternalReport;
|
|
|
18 |
|
|
|
19 |
@interface FIRCLSFileManager : NSObject
|
|
|
20 |
|
|
|
21 |
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
|
|
22 |
|
|
|
23 |
@property(nonatomic, readonly) NSFileManager *underlyingFileManager;
|
|
|
24 |
|
|
|
25 |
/**
|
|
|
26 |
* Returns the folder containing the settings file
|
|
|
27 |
*/
|
|
|
28 |
@property(nonatomic, readonly) NSString *settingsDirectoryPath;
|
|
|
29 |
|
|
|
30 |
/**
|
|
|
31 |
* Returns the path to the settings file
|
|
|
32 |
*/
|
|
|
33 |
@property(nonatomic, readonly) NSString *settingsFilePath;
|
|
|
34 |
|
|
|
35 |
/**
|
|
|
36 |
* Path to the file that holds the ttl and keys that invalidate settings
|
|
|
37 |
*/
|
|
|
38 |
@property(nonatomic, readonly) NSString *settingsCacheKeyPath;
|
|
|
39 |
|
|
|
40 |
@property(nonatomic, readonly) NSString *rootPath;
|
|
|
41 |
@property(nonatomic, readonly) NSString *cachesPath;
|
|
|
42 |
@property(nonatomic, readonly) NSString *structurePath;
|
|
|
43 |
@property(nonatomic, readonly) NSString *activePath;
|
|
|
44 |
@property(nonatomic, readonly) NSString *processingPath;
|
|
|
45 |
@property(nonatomic, readonly) NSString *pendingPath;
|
|
|
46 |
@property(nonatomic, readonly) NSString *preparedPath;
|
|
|
47 |
@property(nonatomic, readonly) NSArray *activePathContents;
|
|
|
48 |
@property(nonatomic, readonly) NSArray *preparedPathContents;
|
|
|
49 |
@property(nonatomic, readonly) NSArray *processingPathContents;
|
|
|
50 |
|
|
|
51 |
- (BOOL)fileExistsAtPath:(NSString *)path;
|
|
|
52 |
- (BOOL)createFileAtPath:(NSString *)path
|
|
|
53 |
contents:(NSData *)data
|
|
|
54 |
attributes:(NSDictionary<NSFileAttributeKey, id> *)attr;
|
|
|
55 |
- (BOOL)createDirectoryAtPath:(NSString *)path;
|
|
|
56 |
- (BOOL)removeItemAtPath:(NSString *)path;
|
|
|
57 |
- (BOOL)removeContentsOfDirectoryAtPath:(NSString *)path;
|
|
|
58 |
- (BOOL)moveItemAtPath:(NSString *)path toDirectory:(NSString *)destDir;
|
|
|
59 |
- (BOOL)didCrashOnPreviousExecution;
|
|
|
60 |
- (BOOL)metricKitDiagnosticFileExists;
|
|
|
61 |
- (void)createEmptyMetricKitFile:(NSString *)reportPath;
|
|
|
62 |
- (void)enumerateFilesInDirectory:(NSString *)directory
|
|
|
63 |
usingBlock:(void (^)(NSString *filePath, NSString *extension))block;
|
|
|
64 |
- (NSNumber *)fileSizeAtPath:(NSString *)path;
|
|
|
65 |
- (NSArray *)contentsOfDirectory:(NSString *)path;
|
|
|
66 |
|
|
|
67 |
// logic of managing files/directories
|
|
|
68 |
- (BOOL)createReportDirectories;
|
|
|
69 |
- (NSString *)setupNewPathForExecutionIdentifier:(NSString *)identifier;
|
|
|
70 |
|
|
|
71 |
- (BOOL)moveItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error;
|
|
|
72 |
|
|
|
73 |
- (NSData *)dataWithContentsOfFile:(NSString *)path;
|
|
|
74 |
|
|
|
75 |
@end
|