.mm: try to simplify load of .mm files
This commit is contained in:
@@ -29,7 +29,8 @@ extern bool change_made, ae_loading;
|
||||
|
||||
void set_up_apple_events(int argc, char* argv[]); // Suppress "no prototype" warning
|
||||
void set_up_apple_events(int, char*[]) {
|
||||
AppleEventHandler* aeHandler = [[AppleEventHandler alloc] init];
|
||||
static AppleEventHandler* aeHandler;
|
||||
aeHandler = [[AppleEventHandler alloc] init];
|
||||
[[NSApplication sharedApplication] setDelegate: aeHandler];
|
||||
}
|
||||
|
||||
@@ -43,13 +44,8 @@ void set_up_apple_events(int, char*[]) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
unsigned long len = [file length], sz = len + 1;
|
||||
auto msg = std::shared_ptr<unichar>(new unichar[sz], std::default_delete<unichar[]>());
|
||||
std::fill(msg.get(), msg.get() + sz, 0);
|
||||
[file getCharacters: msg.get() range: (NSRange){0, len}];
|
||||
std::string fileName;
|
||||
std::copy(msg.get(), msg.get() + len, std::inserter(fileName, fileName.begin()));
|
||||
|
||||
std::string fileName=file.fileSystemRepresentation;
|
||||
|
||||
if(load_scenario(fileName, scenario)) {
|
||||
set_current_town(scenario.last_town_edited);
|
||||
cur_out = scenario.last_out_edited;
|
||||
|
Reference in New Issue
Block a user