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 2020+ (NSURL *)bundleURLForResource : (NSString *)resourceName
2121 withExtension : (NSString *)resourceExtension ;
2222
23- + (NSString *)getDocumentsDirectory ;
23+ + (NSString *)getApplicationSupportDirectory ;
2424
2525@end
2626
Original file line number Diff line number Diff line change @@ -62,10 +62,10 @@ + (NSURL *)bundleURLForResource:(NSString *)resourceName
6262 }
6363}
6464
65- + (NSString *)getDocumentsDirectory
65+ + (NSString *)getApplicationSupportDirectory
6666{
67- NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory , NSUserDomainMask, YES ) objectAtIndex: 0 ];
68- return documentsDirectory ;
67+ NSString *applicationSupportDirectory = [NSSearchPathForDirectoriesInDomains (NSApplicationSupportDirectory , NSUserDomainMask, YES ) objectAtIndex: 0 ];
68+ return applicationSupportDirectory ;
6969}
7070
7171// Private API methods
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ @implementation CodePushPackage
1414
1515+ (NSString *)getCodePushPath
1616{
17- return [[CodePush getDocumentsDirectory ] stringByAppendingPathComponent: @" CodePush" ];
17+ return [[CodePush getApplicationSupportDirectory ] stringByAppendingPathComponent: @" CodePush" ];
1818}
1919
2020+ (NSString *)getDownloadFilePath
@@ -290,6 +290,22 @@ + (void)downloadPackage:(NSDictionary *)updatePackage
290290 }
291291
292292 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+
293309 [mutableUpdatePackage setValue: relativeBundlePath forKey: RelativeBundlePathKey];
294310 } else {
295311 error = [[NSError alloc ] initWithDomain: CodePushErrorDomain
You can’t perform that action at this time.
0 commit comments