-
Notifications
You must be signed in to change notification settings - Fork 3
/
FJSFileManager.h
57 lines (39 loc) · 1.34 KB
/
FJSFileManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// FJSFIleManager.h
// FJSCode
//
// Created by Corey Floyd on 7/13/09.
// Copyright 2009 Flying Jalapeno Software. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef enum {
UserFolderDocuments = 0,
UserFolderCache = 1
} UserFolder;
//TODO: rewrite methods to respond to errors and remove fileExists logic
@interface FJSFileManager : NSObject {
NSString *fileName;
NSString *folderName;
UserFolder saveLocation;
NSDictionary *dataCache;
}
//set these 3 properties to determine where file is loaded or saved
@property(nonatomic,retain)NSString *fileName;
@property(nonatomic,retain)NSString *folderName; //if no folder is set, data will be saved directly into the UserFolder
@property(nonatomic,assign)UserFolder saveLocation;
//holds last loaded or saved dictionary
@property(nonatomic,readonly)NSDictionary *dataCache;
//save and load data
- (BOOL)saveData:(NSDictionary*)data withError:(NSError**)error;
- (NSDictionary*)loadDataWithError:(NSError**)error;
//deleted file at path to fileName
- (BOOL)deleteFileWithError:(NSError**)error;
//create folder at path to folderName
- (BOOL)createFolder;
//delete contents of folderName
- (BOOL)emptyFolderWithError:(NSError**)error;
- (NSString *)folderPath;
- (NSString *)filePath;
@end
//Additional dictionary Keys
extern NSString *const saveDateKey;