mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-05 02:13:40 +00:00
New: xcc --reset resets the Xcode support before opening the project.
This will help in cases where the project is way out of sync and crashes XCC.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// 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 = [NSString stringWithUTF8String:kCloseXcodeProjectScript];
|
||||
NSString *source = [NSString stringWithFormat:format, projectPath];
|
||||
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:source];
|
||||
|
||||
NSAppleEventDescriptor *descriptor;
|
||||
descriptor = [script executeAndReturnError:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user