first commit

This commit is contained in:
SimonSayeBabu
2025-01-17 13:10:20 +01:00
commit bd1057cec0
16967 changed files with 1048699 additions and 0 deletions

View File

@@ -0,0 +1,308 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
E08E02FF236392D000A4B1BE /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = E08E02FE236392D000A4B1BE /* main.mm */; };
E08E03022363933B00A4B1BE /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E08E03012363933B00A4B1BE /* AppKit.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
E08E02F5236392A300A4B1BE /* AppleEventIntegration.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppleEventIntegration.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
E08E02F8236392A300A4B1BE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E08E02FE236392D000A4B1BE /* main.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
E08E03012363933B00A4B1BE /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
E08E02F2236392A300A4B1BE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E08E03022363933B00A4B1BE /* AppKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
E08E02EC236392A300A4B1BE = {
isa = PBXGroup;
children = (
E08E02F7236392A300A4B1BE /* AppleEventIntegration */,
E08E02F6236392A300A4B1BE /* Products */,
E08E03002363933B00A4B1BE /* Frameworks */,
);
sourceTree = "<group>";
};
E08E02F6236392A300A4B1BE /* Products */ = {
isa = PBXGroup;
children = (
E08E02F5236392A300A4B1BE /* AppleEventIntegration.bundle */,
);
name = Products;
sourceTree = "<group>";
};
E08E02F7236392A300A4B1BE /* AppleEventIntegration */ = {
isa = PBXGroup;
children = (
E08E02F8236392A300A4B1BE /* Info.plist */,
E08E02FE236392D000A4B1BE /* main.mm */,
);
path = AppleEventIntegration;
sourceTree = "<group>";
};
E08E03002363933B00A4B1BE /* Frameworks */ = {
isa = PBXGroup;
children = (
E08E03012363933B00A4B1BE /* AppKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
E08E02F4236392A300A4B1BE /* AppleEventIntegration */ = {
isa = PBXNativeTarget;
buildConfigurationList = E08E02FB236392A300A4B1BE /* Build configuration list for PBXNativeTarget "AppleEventIntegration" */;
buildPhases = (
E08E02F1236392A300A4B1BE /* Sources */,
E08E02F2236392A300A4B1BE /* Frameworks */,
E08E02F3236392A300A4B1BE /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = AppleEventIntegration;
productName = AppleEventIntegration;
productReference = E08E02F5236392A300A4B1BE /* AppleEventIntegration.bundle */;
productType = "com.apple.product-type.bundle";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
E08E02ED236392A300A4B1BE /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = Unity;
TargetAttributes = {
E08E02F4236392A300A4B1BE = {
CreatedOnToolsVersion = 11.1;
};
};
};
buildConfigurationList = E08E02F0236392A300A4B1BE /* Build configuration list for PBXProject "AppleEventIntegration" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = E08E02EC236392A300A4B1BE;
productRefGroup = E08E02F6236392A300A4B1BE /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
E08E02F4236392A300A4B1BE /* AppleEventIntegration */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
E08E02F3236392A300A4B1BE /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
E08E02F1236392A300A4B1BE /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E08E02FF236392D000A4B1BE /* main.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
E08E02F9236392A300A4B1BE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
E08E02FA236392A300A4B1BE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.13;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
E08E02FC236392A300A4B1BE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = AppleEventIntegration/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = com.unity.visualstudio.AppleEventIntegration;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
WRAPPER_EXTENSION = bundle;
};
name = Debug;
};
E08E02FD236392A300A4B1BE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = AppleEventIntegration/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.13;
PRODUCT_BUNDLE_IDENTIFIER = com.unity.visualstudio.AppleEventIntegration;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
WRAPPER_EXTENSION = bundle;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
E08E02F0236392A300A4B1BE /* Build configuration list for PBXProject "AppleEventIntegration" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E08E02F9236392A300A4B1BE /* Debug */,
E08E02FA236392A300A4B1BE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
E08E02FB236392A300A4B1BE /* Build configuration list for PBXNativeTarget "AppleEventIntegration" */ = {
isa = XCConfigurationList;
buildConfigurations = (
E08E02FC236392A300A4B1BE /* Debug */,
E08E02FD236392A300A4B1BE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = E08E02ED236392A300A4B1BE /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:AppleEventIntegration.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 Unity. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@@ -0,0 +1,281 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Unity Technologies.
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
// 'FSnd' FourCC
#define keyFileSender 1179872868
// 16 bit aligned legacy struct - this should total 20 bytes
typedef struct _SelectionRange
{
int16_t unused1; // 0 (not used)
int16_t lineNum; // line to select (<0 to specify range)
int32_t startRange; // start of selection range (if line < 0)
int32_t endRange; // end of selection range (if line < 0)
int32_t unused2; // 0 (not used)
int32_t theDate; // modification date/time
} __attribute__((packed)) SelectionRange;
static NSString* MakeNSString(const char* str)
{
if (!str)
return NULL;
NSString* ret = [NSString stringWithUTF8String: str];
return ret;
}
static UInt32 GetCreatorOfThisApp()
{
static UInt32 creator = 0;
if (creator == 0)
{
UInt32 type;
CFBundleGetPackageInfo(CFBundleGetMainBundle(), &type, &creator);
}
return creator;
}
static BOOL OpenFileAtLineWithAppleEvent(NSRunningApplication *runningApp, NSString* path, int line)
{
if (!runningApp)
return NO;
NSURL *pathUrl = [NSURL fileURLWithPath: path];
NSAppleEventDescriptor* targetDescriptor = [NSAppleEventDescriptor
descriptorWithProcessIdentifier: runningApp.processIdentifier];
NSAppleEventDescriptor* appleEvent = [NSAppleEventDescriptor
appleEventWithEventClass: kCoreEventClass
eventID: kAEOpenDocuments
targetDescriptor: targetDescriptor
returnID: kAutoGenerateReturnID
transactionID: kAnyTransactionID];
[appleEvent
setParamDescriptor: [NSAppleEventDescriptor
descriptorWithDescriptorType: typeFileURL
data: [[pathUrl absoluteString] dataUsingEncoding: NSUTF8StringEncoding]]
forKeyword: keyDirectObject];
UInt32 packageCreator = GetCreatorOfThisApp();
if (packageCreator == kUnknownType) {
[appleEvent
setParamDescriptor: [NSAppleEventDescriptor
descriptorWithDescriptorType: typeApplicationBundleID
data: [[[NSBundle mainBundle] bundleIdentifier] dataUsingEncoding: NSUTF8StringEncoding]]
forKeyword: keyFileSender];
} else {
[appleEvent
setParamDescriptor: [NSAppleEventDescriptor descriptorWithTypeCode: packageCreator]
forKeyword: keyFileSender];
}
if (line != -1) {
// Add selection range to event
SelectionRange range;
range.unused1 = 0;
range.lineNum = line - 1;
range.startRange = -1;
range.endRange = -1;
range.unused2 = 0;
range.theDate = -1;
[appleEvent
setParamDescriptor: [NSAppleEventDescriptor
descriptorWithDescriptorType: typeChar
bytes: &range
length: sizeof(SelectionRange)]
forKeyword: keyAEPosition];
}
AEDesc reply = { typeNull, NULL };
OSErr err = AESendMessage(
[appleEvent aeDesc],
&reply,
kAENoReply + kAENeverInteract,
kAEDefaultTimeout);
return err == noErr;
}
static BOOL ApplicationSupportsQueryOpenedSolution(NSString* appPath)
{
NSURL* appUrl = [NSURL fileURLWithPath: appPath];
NSBundle* bundle = [NSBundle bundleWithURL: appUrl];
if (!bundle)
return NO;
id versionValue = [bundle objectForInfoDictionaryKey: @"CFBundleVersion"];
if (!versionValue || ![versionValue isKindOfClass: [NSString class]])
return NO;
NSString* version = (NSString*)versionValue;
return [version compare:@"8.6" options:NSNumericSearch] != NSOrderedAscending;
}
static NSArray<NSRunningApplication*>* QueryRunningInstances(NSString *appPath)
{
NSMutableArray<NSRunningApplication*>* instances = [[NSMutableArray alloc] init];
NSURL *appUrl = [NSURL fileURLWithPath: appPath];
for (NSRunningApplication *runningApp in NSWorkspace.sharedWorkspace.runningApplications) {
if (![runningApp isTerminated] && [runningApp.bundleURL isEqual: appUrl]) {
[instances addObject: runningApp];
}
}
return instances;
}
enum {
kWorkspaceEventClass = 1448302419, /* 'VSWS' FourCC */
kCurrentSelectedSolutionPathEventID = 1129534288 /* 'CSSP' FourCC */
};
static BOOL TryQueryCurrentSolutionPath(NSRunningApplication* runningApp, NSString** solutionPath)
{
NSAppleEventDescriptor* targetDescriptor = [NSAppleEventDescriptor
descriptorWithProcessIdentifier: runningApp.processIdentifier];
NSAppleEventDescriptor* appleEvent = [NSAppleEventDescriptor
appleEventWithEventClass: kWorkspaceEventClass
eventID: kCurrentSelectedSolutionPathEventID
targetDescriptor: targetDescriptor
returnID: kAutoGenerateReturnID
transactionID: kAnyTransactionID];
AEDesc aeReply = { 0, };
OSErr sendResult = AESendMessage(
[appleEvent aeDesc],
&aeReply,
kAEWaitReply | kAENeverInteract,
kAEDefaultTimeout);
if (sendResult != noErr) {
return NO;
}
NSAppleEventDescriptor *reply = [[NSAppleEventDescriptor alloc] initWithAEDescNoCopy: &aeReply];
*solutionPath = [[reply descriptorForKeyword: keyDirectObject] stringValue];
return *solutionPath != NULL;
}
static NSRunningApplication* QueryRunningApplicationOpenedOnSolution(NSString* appPath, NSString* solutionPath)
{
BOOL supportsQueryOpenedSolution = ApplicationSupportsQueryOpenedSolution(appPath);
for (NSRunningApplication *runningApp in QueryRunningInstances(appPath)) {
// If the currently selected external editor does not support the opened solution apple event
// then fallback to the previous behavior: take the first opened VSM and open the solution
if (!supportsQueryOpenedSolution) {
OpenFileAtLineWithAppleEvent(runningApp, solutionPath, -1);
return runningApp;
}
NSString* currentSolutionPath;
if (TryQueryCurrentSolutionPath(runningApp, &currentSolutionPath)) {
if ([solutionPath isEqual:currentSolutionPath]) {
return runningApp;
}
} else {
// If VSM doesn't respond to the query opened solution event
// we fallback to the previous behavior too
OpenFileAtLineWithAppleEvent(runningApp, solutionPath, -1);
return runningApp;
}
}
return NULL;
}
static NSRunningApplication* LaunchApplicationOnSolution(NSString* appPath, NSString* solutionPath)
{
return [[NSWorkspace sharedWorkspace]
launchApplicationAtURL: [NSURL fileURLWithPath: appPath]
options: NSWorkspaceLaunchDefault | NSWorkspaceLaunchNewInstance
configuration: @{
NSWorkspaceLaunchConfigurationArguments: @[ solutionPath ],
}
error: nil];
}
static NSRunningApplication* QueryOrLaunchApplication(NSString* appPath, NSString* solutionPath)
{
NSRunningApplication* runningApp = QueryRunningApplicationOpenedOnSolution(appPath, solutionPath);
if (!runningApp)
runningApp = LaunchApplicationOnSolution(appPath, solutionPath);
if (runningApp)
[runningApp activateWithOptions: 0];
return runningApp;
}
BOOL LaunchOrReuseApp(NSString* appPath, NSString* solutionPath, NSRunningApplication** outApp)
{
NSRunningApplication* app = QueryOrLaunchApplication(appPath, solutionPath);
if (outApp)
*outApp = app;
return app != NULL;
}
BOOL MonoDevelopOpenFile(NSString* appPath, NSString* solutionPath, NSString* filePath, int line)
{
NSRunningApplication* runningApp;
if (!LaunchOrReuseApp(appPath, solutionPath, &runningApp)) {
return FALSE;
}
if (filePath) {
return OpenFileAtLineWithAppleEvent(runningApp, filePath, line);
}
return YES;
}
#if BUILD_APP
int main(int argc, const char** argv)
{
if (argc != 5) {
printf("Usage: AppleEventIntegration appPath solutionPath filePath lineNumber\n");
return 1;
}
const char* appPath = argv[1];
const char* solutionPath = argv[2];
const char* filePath = argv[3];
const int lineNumber = atoi(argv[4]);
@autoreleasepool
{
MonoDevelopOpenFile(MakeNSString(appPath), MakeNSString(solutionPath), MakeNSString(filePath), lineNumber);
}
return 0;
}
#else
extern "C"
{
BOOL OpenVisualStudio(const char* appPath, const char* solutionPath, const char* filePath, int line)
{
return MonoDevelopOpenFile(MakeNSString(appPath), MakeNSString(solutionPath), MakeNSString(filePath), line);
}
}
#endif

View File

@@ -0,0 +1,5 @@
Bundle style (release)
xcodebuild -configuration Release
Standalone style (test)
clang++ -D BUILD_APP -framework Foundation -framework AppKit main.mm