mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 13:07:02 +00:00
XcodeCapp 4.0 is a major release of our beloved tool. In a nutshell it: - allows to manage multiple projects simultaneously - allows to follow operations and cancel them - has a per project Error and Warning reporting - supports capp_env as you can define additional paths and objj include path per project - much more things
40 lines
1.1 KiB
Objective-C
40 lines
1.1 KiB
Objective-C
//
|
|
// XcodeProjectCloser.m
|
|
// XcodeCapp
|
|
//
|
|
// Created by Aparajita on 5/12/13.
|
|
// Copyright (c) 2013 Cappuccino Project. All rights reserved.
|
|
//
|
|
|
|
#import "XcodeProjectCloser.h"
|
|
|
|
|
|
// Used to close the Xcode project if it is open.
|
|
static const char *kCloseXcodeProjectScript =
|
|
"tell application \"Xcode\"\n"
|
|
"set docs to (document of every window)\n"
|
|
"repeat with doc in docs\n"
|
|
"if class of doc is workspace document then\n"
|
|
"set docPath to path of doc\n"
|
|
"if docPath begins with \"%@\" then\n"
|
|
"close doc\n"
|
|
"return\n"
|
|
"end if\n"
|
|
"end if\n"
|
|
"end repeat\n"
|
|
"end tell";
|
|
|
|
|
|
@implementation XcodeProjectCloser
|
|
|
|
+ (void)closeXcodeProjectForProject:(NSString *)projectPath
|
|
{
|
|
NSString *format = @(kCloseXcodeProjectScript);
|
|
NSString *source = [NSString stringWithFormat:format, projectPath];
|
|
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:source];
|
|
|
|
[script executeAndReturnError:nil];
|
|
}
|
|
|
|
@end
|