forked from tidev/titanium-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: move privacy-related files to own file outside TitaniumKit
- Loading branch information
1 parent
2f1212f
commit 5e95ac0
Showing
4 changed files
with
82 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Titanium SDK | ||
* Copyright TiDev, Inc. 04/07/2022-Present. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
|
||
#import <TitaniumKit/TiBase.h> | ||
#import <TitaniumKit/TiFilesystemFileProxy.h> | ||
|
||
@interface TiFilesystemFileProxy (Addons) | ||
|
||
#ifdef USE_TI_FILESYSTEMCREATEDAT | ||
- (NSDate *)createdAt:(id)unused; | ||
#endif | ||
|
||
#ifdef USE_TI_FILESYSTEMMODIFIEDAT | ||
- (NSDate *)modifiedAt:(id)unused; | ||
#endif | ||
|
||
#ifdef USE_TI_FILESYSTEMSPACEAVAILABLE | ||
- (NSNumber *)spaceAvailable:(id)unused; | ||
#endif | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* Titanium SDK | ||
* Copyright TiDev, Inc. 04/07/2022-Present. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
|
||
#import "TiFilesystemFileProxy+Addons.h" | ||
|
||
@implementation TiFilesystemFileProxy (Addons) | ||
|
||
#ifdef USE_TI_FILESYSTEMCREATEDAT | ||
- (NSDate *)createdAt:(id)unused | ||
{ | ||
NSError *error = nil; | ||
NSDictionary *resultDict = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:&error]; | ||
if (error != nil) { | ||
[self throwException:TiExceptionOSError subreason:[error localizedDescription] location:CODELOCATION]; | ||
} | ||
|
||
return [resultDict objectForKey:NSFileCreationDate] ?: [resultDict objectForKey:NSFileModificationDate]; | ||
} | ||
#endif | ||
|
||
#ifdef USE_TI_FILESYSTEMMODIFIEDAT | ||
- (NSDate *)modifiedAt:(id)unused | ||
{ | ||
NSError *error = nil; | ||
NSDictionary *resultDict = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:&error]; | ||
if (error != nil) { | ||
[self throwException:TiExceptionOSError subreason:[error localizedDescription] location:CODELOCATION]; | ||
} | ||
return [resultDict objectForKey:NSFileModificationDate]; | ||
} | ||
#endif | ||
|
||
#ifdef USE_TI_FILESYSTEMSPACEAVAILABLE | ||
- (NSNumber *)spaceAvailable:(id)unused | ||
{ | ||
NSError *error = nil; | ||
NSDictionary *resultDict = [[NSFileManager defaultManager] attributesOfFileSystemForPath:path error:&error]; | ||
if (error != nil) { | ||
NSLog(@"[ERROR] Could not receive available space: %@", error.localizedDescription); | ||
return @(0.0); | ||
} | ||
return [resultDict objectForKey:NSFileSystemFreeSize]; | ||
} | ||
#endif | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters