Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2015-04-17 16:44:54 -0400
committerPascal Rapicault2015-04-20 18:09:24 -0400
commit44336d8123b71d1df865d51e0f2eaf2e1bad615f (patch)
treea29ad412f37b97b1849446f9ec5d6d83cde29a64 /features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c
parent5ebd8e732dcca11efc03ac4721e1909565caf679 (diff)
downloadrt.equinox.framework-44336d8123b71d1df865d51e0f2eaf2e1bad615f.tar.gz
rt.equinox.framework-44336d8123b71d1df865d51e0f2eaf2e1bad615f.tar.xz
rt.equinox.framework-44336d8123b71d1df865d51e0f2eaf2e1bad615f.zip
Bug 461725 - [Mac] Default the configuration to Application SupportI20150421-0800
Change-Id: I6fa3f69c56592245992c11db37ac91e254ad7d68 Signed-off-by: Pascal Rapicault <pascal@rapicorp.com>
Diffstat (limited to 'features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c')
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c b/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c
index b76584a56..024f524d7 100644
--- a/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c
+++ b/features/org.eclipse.equinox.executable.feature/library/carbon/eclipseCarbon.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Andre Weinand (OTI Labs)
* David Green - OpenJDK bsd port integration
+ * Rapicorp, Inc - Default the configuration to Application Support (bug 461725)
*/
/* MacOS X Carbon specific logic for displaying the splash screen. */
@@ -18,6 +19,8 @@
#include "eclipseJNI.h"
#include "eclipseUtil.h"
+#include <sys/xattr.h>
+ #include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <CoreServices/CoreServices.h>
@@ -38,6 +41,7 @@
#define DEBUG 0
static _TCHAR* noForkingMsg = _T_ECLIPSE("Internal Error, forking the jvm is not supported on MacOS.\n");
+static const _TCHAR* INSTALL_UUID = _T_ECLIPSE("eclipse.uuid");
char *findCommand(char *command);
@@ -869,3 +873,37 @@ void processVMArgs(char **vmargs[] )
int isMaxPermSizeVM( _TCHAR * javaVM, _TCHAR * jniLib ) {
return isSunMaxPermSizeVM;
}
+
+NSString* getApplicationSupport() {
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
+ NSString *documentsDirectory = [paths objectAtIndex:0];
+ return documentsDirectory;
+
+}
+
+NSString* getCFBundleIdentifier() {
+ CFBundleRef mainBundle= CFBundleGetMainBundle();
+ return (NSString*) CFBundleGetIdentifier(mainBundle);
+}
+
+const char* getUUID() {
+ const char * installPath = [[[NSBundle mainBundle] resourcePath] fileSystemRepresentation];
+ int bufferLength = getxattr(installPath, INSTALL_UUID, NULL, 0, 0, 0);
+ if (bufferLength != -1) {
+ char *buffer = malloc(bufferLength + 1);
+ buffer[bufferLength] = '\0';
+ getxattr(installPath, INSTALL_UUID, buffer, bufferLength, 0, 0);
+ return buffer;
+ }
+
+ NSString * timestamp = [NSString stringWithFormat:@"%f",[[NSDate date] timeIntervalSince1970] * 1000];
+ const char* timestampAsChar = [timestamp UTF8String];
+ setxattr(installPath, INSTALL_UUID, timestampAsChar, strlen(timestampAsChar), 0, 0);
+ return timestampAsChar;
+}
+
+_TCHAR* getFolderForApplicationData() {
+ NSString* bundleId = getCFBundleIdentifier();
+ NSString* appSupport = getApplicationSupport();
+ return [[NSString stringWithFormat:@"%@/%@_%s", appSupport, bundleId, getUUID()] UTF8String];
+}

Back to the top