mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
fix dependencies building, looks like i cant use the sim bc libs are compiled for ios
This commit is contained in:
28
Carthage/Checkouts/NMSSH/NMSSHTests/Settings/ConfigHelper.m
vendored
Normal file
28
Carthage/Checkouts/NMSSH/NMSSHTests/Settings/ConfigHelper.m
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
#import "ConfigHelper.h"
|
||||
#import <YAML/YAMLSerialization.h>
|
||||
|
||||
@implementation ConfigHelper
|
||||
|
||||
+ (id)valueForKey:(NSString *)key {
|
||||
static id yaml;
|
||||
|
||||
if (!yaml) {
|
||||
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
|
||||
NSString *path = [bundle pathForResource:@"config" ofType:@"yml"];
|
||||
|
||||
NSInputStream *stream = [[NSInputStream alloc] initWithFileAtPath:path];
|
||||
yaml = [YAMLSerialization YAMLWithStream:stream
|
||||
options:kYAMLReadOptionStringScalars
|
||||
error:nil];
|
||||
}
|
||||
|
||||
id data = [yaml objectAtIndex:0];
|
||||
NSArray *keyList = [key componentsSeparatedByString:@"."];
|
||||
for (NSString *keyPart in keyList) {
|
||||
data = [data objectForKey:keyPart];
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user