This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 20
20
+ (NSURL *)bundleURLForResource : (NSString *)resourceName
21
21
withExtension : (NSString *)resourceExtension ;
22
22
23
- + (NSString *)getDocumentsDirectory ;
23
+ + (NSString *)getApplicationSupportDirectory ;
24
24
25
25
@end
26
26
Original file line number Diff line number Diff line change @@ -62,10 +62,10 @@ + (NSURL *)bundleURLForResource:(NSString *)resourceName
62
62
}
63
63
}
64
64
65
- + (NSString *)getDocumentsDirectory
65
+ + (NSString *)getApplicationSupportDirectory
66
66
{
67
- NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory , NSUserDomainMask, YES ) objectAtIndex: 0 ];
68
- return documentsDirectory ;
67
+ NSString *applicationSupportDirectory = [NSSearchPathForDirectoriesInDomains (NSApplicationSupportDirectory , NSUserDomainMask, YES ) objectAtIndex: 0 ];
68
+ return applicationSupportDirectory ;
69
69
}
70
70
71
71
// Private API methods
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ @implementation CodePushPackage
14
14
15
15
+ (NSString *)getCodePushPath
16
16
{
17
- return [[CodePush getDocumentsDirectory ] stringByAppendingPathComponent: @" CodePush" ];
17
+ return [[CodePush getApplicationSupportDirectory ] stringByAppendingPathComponent: @" CodePush" ];
18
18
}
19
19
20
20
+ (NSString *)getDownloadFilePath
@@ -290,6 +290,22 @@ + (void)downloadPackage:(NSDictionary *)updatePackage
290
290
}
291
291
292
292
if (relativeBundlePath) {
293
+ NSString *absoluteBundlePath = [newPackageFolderPath stringByAppendingPathComponent: relativeBundlePath];
294
+ NSDictionary *bundleFileAttributes = [[[NSFileManager defaultManager ] attributesOfItemAtPath: absoluteBundlePath error: &error] mutableCopy ];
295
+ if (error) {
296
+ failCallback (error);
297
+ return ;
298
+ }
299
+
300
+ [bundleFileAttributes setValue: [NSDate date ] forKey: NSFileModificationDate ];
301
+ [[NSFileManager defaultManager ] setAttributes: bundleFileAttributes
302
+ ofItemAtPath: absoluteBundlePath
303
+ error: &error];
304
+ if (error) {
305
+ failCallback (error);
306
+ return ;
307
+ }
308
+
293
309
[mutableUpdatePackage setValue: relativeBundlePath forKey: RelativeBundlePathKey];
294
310
} else {
295
311
error = [[NSError alloc ] initWithDomain: CodePushErrorDomain
You can’t perform that action at this time.
0 commit comments