rename engine to src

This commit is contained in:
2018-09-16 14:21:58 +02:00
parent eccb34724e
commit 71de44a7c1
120 changed files with 282 additions and 282 deletions

36
src/objc_utils.cpp Normal file
View File

@@ -0,0 +1,36 @@
#include "pch.h"
#include "objc_utils.h"
#ifdef __OBJC__
@implementation PathWithModDate
@end
@implementation ObjcUtils
+ (NSArray*)getFilesAtPathSortedByModificationDate:(NSString*)folderPath
{
NSArray *allPaths = [NSFileManager.defaultManager contentsOfDirectoryAtPath:folderPath error:nil];
NSMutableArray *sortedPaths = [NSMutableArray new];
for (NSString *path in allPaths) {
NSString *fullPath = [folderPath stringByAppendingPathComponent:path];
NSDictionary *attr = [NSFileManager.defaultManager attributesOfItemAtPath:fullPath error:nil];
NSDate *modDate = [attr objectForKey:NSFileModificationDate];
PathWithModDate *pathWithDate = [[PathWithModDate alloc] init];
pathWithDate.path = fullPath;
pathWithDate.modDate = modDate;
[sortedPaths addObject:pathWithDate];
}
[sortedPaths sortUsingComparator:^(PathWithModDate *path1, PathWithModDate *path2) {
// Descending (most recently modified first)
return [path2.modDate compare:path1.modDate];
}];
return sortedPaths;
}
@end
#endif