-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLogsCommand.m
executable file
·49 lines (42 loc) · 1.42 KB
/
LogsCommand.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// LogsCommand.m
// Atlantis
//
// Created by Rachel Blackman on 4/30/11.
// Copyright 2011 Riverdark Studios. All rights reserved.
//
#import "LogsCommand.h"
#import "AtlantisState.h"
#import "RDAtlantisWorldInstance.h"
@implementation LogsCommand
- (NSString *) checkOptionsForState:(AtlantisState *) state
{
return nil;
}
- (void) executeForState:(AtlantisState *) state
{
RDAtlantisWorldInstance *world = [state world];
NSArray *logs = [world logfiles];
if ([logs count]) {
RDLogType *log;
NSEnumerator *logEnum = [logs objectEnumerator];
while (log = [logEnum nextObject]) {
NSString *targetName = nil;
if ([log spawnPath]) {
if ([[log spawnPath] length])
targetName = [NSString stringWithFormat:@"Logging spawn %@ to", [log spawnPath]];
else
targetName = [NSString stringWithFormat:@"Logging root spawn to"];
}
else {
targetName = [NSString stringWithFormat:@"Logging world to"];
}
NSString *tempString = [NSString stringWithFormat:@"%@ %@", targetName, [log filename]];
[[state world] outputStatus:tempString toSpawn:[state spawnPath]];
}
}
else {
[[state world] outputStatus:[NSString stringWithFormat:@"No logs open for %@", [[state world] basePath]] toSpawn:[state spawnPath]];
}
}
@end