Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 43f0f44

Browse files
committed
Merge pull request #21 from Microsoft/use-documents-directory
Use documents directory
2 parents 4626f5a + a5c9111 commit 43f0f44

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

CodePush.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
@interface CodePush : NSObject <RCTBridgeModule>
44

5+
+ (NSString *) getDocumentsDirectory;
6+
57
+ (NSURL *) getBundleUrl;
68

79
@end

CodePush.m

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ @implementation CodePush
1515

1616
@synthesize bridge = _bridge;
1717

18+
+ (NSString *)getDocumentsDirectory
19+
{
20+
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES) objectAtIndex:0];
21+
return documentsDirectory;
22+
}
23+
1824
+ (NSString *) getBundlePath
1925
{
2026
NSString * bundleFolderPath = [self getPackageFolderPath];
@@ -24,17 +30,17 @@ + (NSString *) getBundlePath
2430

2531
+ (NSString *) getPackageFolderPath
2632
{
27-
NSString* home = NSHomeDirectory();
33+
NSString* documentsDirectory = [self getDocumentsDirectory];
2834
NSString* pathExtension = [[@"CodePush/" stringByAppendingString: (usingTestFolder ? @"test/" : @"")] stringByAppendingString: @"currentPackage"];
29-
NSString* packageFolder = [home stringByAppendingPathComponent:pathExtension];
35+
NSString* packageFolder = [documentsDirectory stringByAppendingPathComponent:pathExtension];
3036
return packageFolder;
3137
}
3238

3339
+ (NSString *) getPreviousPackageFolderPath
3440
{
35-
NSString* home = NSHomeDirectory();
41+
NSString* documentsDirectory = [self getDocumentsDirectory];
3642
NSString* pathExtension = [[@"CodePush/" stringByAppendingString: (usingTestFolder ? @"test/" : @"")] stringByAppendingString: @"previous"];
37-
NSString* packageFolder = [home stringByAppendingPathComponent:pathExtension];
43+
NSString* packageFolder = [documentsDirectory stringByAppendingPathComponent:pathExtension];
3844
return packageFolder;
3945
}
4046

CodePushPackage.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ @implementation CodePushPackage
66

77
+ (NSString *)getCodePushPath
88
{
9-
return [NSHomeDirectory() stringByAppendingPathComponent:@"CodePush"];
9+
return [[CodePush getDocumentsDirectory] stringByAppendingPathComponent:@"CodePush"];
1010
}
1111

1212
+ (NSString *)getStatusFilePath

0 commit comments

Comments
 (0)