mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-30 14:17:40 +00:00
New: added xcc executable to open a project in XcodeCapp from command line.
Usage: xcc [directory] Updated help accordingly.
This commit is contained in:
@@ -41,6 +41,17 @@ task ("build", function()
|
||||
|
||||
if (OS.system("xcodebuild " + args))
|
||||
OS.exit(1);
|
||||
|
||||
if (!executableExists("xcc"))
|
||||
{
|
||||
print("\nWould you like to install the xcc command line tool in /usr/local/bin? yes or no:");
|
||||
|
||||
if (system.stdin.readLine() == "yes\n")
|
||||
{
|
||||
sudo(["mkdir", "-p", "/usr/local/bin"]);
|
||||
sudo(["ln", "-s", "/Applications/XcodeCapp.app/Contents/MacOS/xcc", "/usr/local/bin/"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
E170C40517298833003DC489 /* icon-error@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E170C40017298833003DC489 /* icon-error@2x.png */; };
|
||||
E170C40617298833003DC489 /* icon-inactive@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E170C40117298833003DC489 /* icon-inactive@2x.png */; };
|
||||
E170C40717298833003DC489 /* icon-working@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E170C40217298833003DC489 /* icon-working@2x.png */; };
|
||||
E171D25F173C168C00210893 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E171D25E173C168C00210893 /* Foundation.framework */; };
|
||||
E171D262173C168C00210893 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E171D261173C168C00210893 /* main.m */; };
|
||||
E171D26A173C1ADD00210893 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E164FE1D1720F50100263CE3 /* CoreServices.framework */; };
|
||||
E171D26C173C1C8300210893 /* xcc in CopyFiles */ = {isa = PBXBuildFile; fileRef = E171D25D173C168C00210893 /* xcc */; };
|
||||
E17A822D172700B90095CD83 /* XcodeCapp.iconset in Resources */ = {isa = PBXBuildFile; fileRef = E17A822C172700B90095CD83 /* XcodeCapp.iconset */; };
|
||||
E17B55411732F57700809FFB /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E17B55401732F57700809FFB /* Quartz.framework */; };
|
||||
E17B55431732F72700809FFB /* help.pdf in Resources */ = {isa = PBXBuildFile; fileRef = E17B55421732F72700809FFB /* help.pdf */; };
|
||||
@@ -45,6 +49,16 @@
|
||||
E1ED6B72173414E100641628 /* icon_128x128@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = E1ED6B70173414E100641628 /* icon_128x128@2x.png */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
E171D26D173C405C00210893 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = E164FDC71720E77100263CE3 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = E171D25C173C168C00210893;
|
||||
remoteInfo = xcc;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
E164FE201720F54800263CE3 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
@@ -68,6 +82,25 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E171D25B173C168C00210893 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
E171D26B173C1C6900210893 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 6;
|
||||
files = (
|
||||
E171D26C173C1C8300210893 /* xcc in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@@ -97,6 +130,10 @@
|
||||
E170C40017298833003DC489 /* icon-error@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon-error@2x.png"; path = "Resources/icon-error@2x.png"; sourceTree = "<group>"; };
|
||||
E170C40117298833003DC489 /* icon-inactive@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon-inactive@2x.png"; path = "Resources/icon-inactive@2x.png"; sourceTree = "<group>"; };
|
||||
E170C40217298833003DC489 /* icon-working@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon-working@2x.png"; path = "Resources/icon-working@2x.png"; sourceTree = "<group>"; };
|
||||
E171D25D173C168C00210893 /* xcc */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = xcc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E171D25E173C168C00210893 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
E171D261173C168C00210893 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
E171D264173C168C00210893 /* xcc-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "xcc-Prefix.pch"; sourceTree = "<group>"; };
|
||||
E17A822C172700B90095CD83 /* XcodeCapp.iconset */ = {isa = PBXFileReference; lastKnownFileType = folder.iconset; name = XcodeCapp.iconset; path = Resources/XcodeCapp.iconset; sourceTree = "<group>"; };
|
||||
E17B55401732F57700809FFB /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; };
|
||||
E17B55421732F72700809FFB /* help.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; name = help.pdf; path = Resources/help.pdf; sourceTree = "<group>"; };
|
||||
@@ -137,6 +174,15 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E171D25A173C168C00210893 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E171D26A173C1ADD00210893 /* CoreServices.framework in Frameworks */,
|
||||
E171D25F173C168C00210893 /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@@ -144,6 +190,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E164FDD81720E77100263CE3 /* XcodeCapp */,
|
||||
E171D260173C168C00210893 /* xcc */,
|
||||
E164FDD11720E77100263CE3 /* Frameworks */,
|
||||
E164FDD01720E77100263CE3 /* Products */,
|
||||
);
|
||||
@@ -153,6 +200,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E164FDCF1720E77100263CE3 /* XcodeCapp.app */,
|
||||
E171D25D173C168C00210893 /* xcc */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -163,6 +211,7 @@
|
||||
E164FDD21720E77100263CE3 /* Cocoa.framework */,
|
||||
E164FE1D1720F50100263CE3 /* CoreServices.framework */,
|
||||
E164FDF61720EBD600263CE3 /* Growl.framework */,
|
||||
E171D25E173C168C00210893 /* Foundation.framework */,
|
||||
E164FDD41720E77100263CE3 /* Other Frameworks */,
|
||||
);
|
||||
name = Frameworks;
|
||||
@@ -246,6 +295,23 @@
|
||||
path = Scripts;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E171D260173C168C00210893 /* xcc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E171D261173C168C00210893 /* main.m */,
|
||||
E171D263173C168C00210893 /* Supporting Files */,
|
||||
);
|
||||
path = xcc;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E171D263173C168C00210893 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E171D264173C168C00210893 /* xcc-Prefix.pch */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E1A55947172C5EA80088FB61 /* Operations */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -282,16 +348,35 @@
|
||||
E164FDCD1720E77100263CE3 /* Resources */,
|
||||
E164FE201720F54800263CE3 /* CopyFiles */,
|
||||
E170C3F9172961E6003DC489 /* CopyFiles */,
|
||||
E171D26B173C1C6900210893 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
E171D26E173C405C00210893 /* PBXTargetDependency */,
|
||||
);
|
||||
name = XcodeCapp;
|
||||
productName = XcodeCapp;
|
||||
productReference = E164FDCF1720E77100263CE3 /* XcodeCapp.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
E171D25C173C168C00210893 /* xcc */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = E171D269173C168C00210893 /* Build configuration list for PBXNativeTarget "xcc" */;
|
||||
buildPhases = (
|
||||
E171D259173C168C00210893 /* Sources */,
|
||||
E171D25A173C168C00210893 /* Frameworks */,
|
||||
E171D25B173C168C00210893 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = xcc;
|
||||
productName = xcc;
|
||||
productReference = E171D25D173C168C00210893 /* xcc */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
@@ -314,6 +399,7 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
E164FDCE1720E77100263CE3 /* XcodeCapp */,
|
||||
E171D25C173C168C00210893 /* xcc */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -364,8 +450,24 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E171D259173C168C00210893 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E171D262173C168C00210893 /* main.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
E171D26E173C405C00210893 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = E171D25C173C168C00210893 /* xcc */;
|
||||
targetProxy = E171D26D173C405C00210893 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
E1E90C60173B42D0005C6D5B /* MainMenu.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
@@ -426,6 +528,72 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
E171D267173C168C00210893 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "xcc/xcc-Prefix.pch";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E171D268173C168C00210893 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEPLOYMENT_LOCATION = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "xcc/xcc-Prefix.pch";
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.8;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -447,6 +615,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
E171D269173C168C00210893 /* Build configuration list for PBXNativeTarget "xcc" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E171D267173C168C00210893 /* Debug */,
|
||||
E171D268173C168C00210893 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = E164FDC71720E77100263CE3 /* Project object */;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
- (IBAction)openHelp:(id)aSender;
|
||||
- (IBAction)openAbout:(id)aSender;
|
||||
|
||||
- (void)loadProjectAtPath:(NSString *)path;
|
||||
- (BOOL)loadProjectAtPath:(NSString *)path;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ AppController *SharedAppControllerInstance = nil;
|
||||
@property (nonatomic) NSMenu *recentMenu;
|
||||
@property NSStatusItem *statusItem;
|
||||
@property NSString *finderName;
|
||||
@property BOOL appFinishedLaunching;
|
||||
@property NSString *pathToOpenAtLaunch;
|
||||
|
||||
@end
|
||||
|
||||
@@ -68,8 +70,25 @@ AppController *SharedAppControllerInstance = nil;
|
||||
[self checkFirstLaunch];
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
|
||||
{
|
||||
if (filename)
|
||||
{
|
||||
NSString *path = filename.stringByStandardizingPath;
|
||||
|
||||
if (self.appFinishedLaunching)
|
||||
return [self loadProjectAtPath:path];
|
||||
else
|
||||
self.pathToOpenAtLaunch = path;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
self.appFinishedLaunching = YES;
|
||||
|
||||
if (![self.xcc executablesAreAccessible])
|
||||
{
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
@@ -80,17 +99,21 @@ AppController *SharedAppControllerInstance = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
// If we were opened from the command line, xcc.projectPath will be set.
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (![defaults boolForKey:kDefaultXCCReopenLastProject])
|
||||
return;
|
||||
|
||||
NSString *lastOpenedPath = [defaults objectForKey:kDefaultLastOpenedPath];
|
||||
|
||||
if (lastOpenedPath)
|
||||
|
||||
if (!self.pathToOpenAtLaunch)
|
||||
{
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:lastOpenedPath])
|
||||
[self loadProjectAtPath:lastOpenedPath];
|
||||
if (![defaults boolForKey:kDefaultXCCReopenLastProject])
|
||||
return;
|
||||
|
||||
self.pathToOpenAtLaunch = [defaults objectForKey:kDefaultLastOpenedPath];
|
||||
}
|
||||
|
||||
if (self.pathToOpenAtLaunch)
|
||||
{
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:self.pathToOpenAtLaunch])
|
||||
[self loadProjectAtPath:self.pathToOpenAtLaunch];
|
||||
else
|
||||
[defaults removeObjectForKey:kDefaultLastOpenedPath];
|
||||
}
|
||||
@@ -403,10 +426,10 @@ AppController *SharedAppControllerInstance = nil;
|
||||
|
||||
#pragma mark - Private Helpers
|
||||
|
||||
- (void)loadProjectAtPath:(NSString *)path
|
||||
- (BOOL)loadProjectAtPath:(NSString *)path
|
||||
{
|
||||
if ([self.xcc.projectPath isEqualToString:path])
|
||||
return;
|
||||
return YES;
|
||||
|
||||
[self closeProject:self];
|
||||
|
||||
@@ -437,7 +460,12 @@ AppController *SharedAppControllerInstance = nil;
|
||||
[self updateHistoryMenu];
|
||||
|
||||
if (exists && isDirectory)
|
||||
{
|
||||
[self.xcc loadProjectAtPath:path];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)openWindow:(NSWindow *)aWindow
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.2</string>
|
||||
<string>3.0.3</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.0.2</string>
|
||||
<string>3.0.3</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.developer-tools</string>
|
||||
<key>LSUIElement</key>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// main.m
|
||||
// xcc
|
||||
//
|
||||
// Created by Aparajita on 5/9/13.
|
||||
// Copyright (c) 2013 Cappuccino Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
BOOL validArgs = argc == 1;
|
||||
NSMutableArray *arguments = [[NSMutableArray alloc] initWithObjects:@"-b", @"org.cappuccino.xcodecapp", @"-g", nil];
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
const char *arg = argv[1];
|
||||
|
||||
if (arg[0] == '-')
|
||||
{
|
||||
printf("Usage: xcc [--help | directory]\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *path = [[NSString stringWithUTF8String:arg] stringByStandardizingPath];
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
BOOL isDirectory;
|
||||
BOOL exists = [fm fileExistsAtPath:path isDirectory:&isDirectory];
|
||||
|
||||
if (!exists)
|
||||
fprintf(stderr, "%s: no such file or directory\n", arg);
|
||||
else if (!isDirectory)
|
||||
fprintf(stderr, "%s is not a directory\n", arg);
|
||||
else
|
||||
{
|
||||
validArgs = YES;
|
||||
[arguments addObject:path];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validArgs)
|
||||
{
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
task.launchPath = @"/usr/bin/open";
|
||||
task.arguments = arguments;
|
||||
[task launch];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'xcc' target in the 'xcc' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
Reference in New Issue
Block a user