diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake
index e3369e3afb..bf98dba29d 100644
--- a/cmake/macros/SetPackagingParameters.cmake
+++ b/cmake/macros/SetPackagingParameters.cmake
@@ -38,7 +38,7 @@ macro(SET_PACKAGING_PARAMETERS)
set(BUILD_ORGANIZATION "High Fidelity")
set(HIGH_FIDELITY_PROTOCOL "hifi")
set(HIGH_FIDELITY_APP_PROTOCOL "hifiapp")
- set(INTERFACE_BUNDLE_NAME "Interface")
+ set(INTERFACE_BUNDLE_NAME "interface")
set(INTERFACE_ICON_PREFIX "interface")
# add definition for this release type
@@ -61,7 +61,7 @@ macro(SET_PACKAGING_PARAMETERS)
set(PR_BUILD 1)
set(BUILD_VERSION "PR${RELEASE_NUMBER}")
set(BUILD_ORGANIZATION "High Fidelity - PR${RELEASE_NUMBER}")
- set(INTERFACE_BUNDLE_NAME "Interface")
+ set(INTERFACE_BUNDLE_NAME "interface")
set(INTERFACE_ICON_PREFIX "interface-beta")
# add definition for this release type
@@ -70,7 +70,7 @@ macro(SET_PACKAGING_PARAMETERS)
set(DEV_BUILD 1)
set(BUILD_VERSION "dev")
set(BUILD_ORGANIZATION "High Fidelity - ${BUILD_VERSION}")
- set(INTERFACE_BUNDLE_NAME "Interface")
+ set(INTERFACE_BUNDLE_NAME "interface")
set(INTERFACE_ICON_PREFIX "interface-beta")
# add definition for this release type
diff --git a/interface/interface.entitlements b/interface/interface.entitlements
new file mode 100644
index 0000000000..e41b568d42
--- /dev/null
+++ b/interface/interface.entitlements
@@ -0,0 +1,20 @@
+
+
+
+
+ com.apple.security.application-groups
+
+ high-fidelity.hifi
+
+ com.apple.security.cs.allow-jit
+
+ com.apple.security.cs.allow-unsigned-executable-memory
+
+ com.apple.security.device.audio-input
+
+ com.apple.security.network.client
+
+ com.apple.security.network.server
+
+
+
diff --git a/interface/src/main.cpp b/interface/src/main.cpp
index a8710159b4..9af1d07309 100644
--- a/interface/src/main.cpp
+++ b/interface/src/main.cpp
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -117,21 +118,27 @@ int main(int argc, const char* argv[]) {
}
QString applicationPath;
+ // A temporary application instance is needed to get the location of the running executable
+ // Tests using high_resolution_clock show that this takes about 30-50 microseconds (on my machine, YMMV)
+ // If we wanted to avoid the QCoreApplication, we would need to write our own
+ // cross-platform implementation.
{
- // A temporary application instance is needed to get the location of the running executable
- // Tests using high_resolution_clock show that this takes about 30-50 microseconds (on my machine, YMMV)
- // If we wanted to avoid the QCoreApplication, we would need to write our own
- // cross-platform implementation.
QCoreApplication tempApp(argc, const_cast(argv));
+#ifdef Q_OS_OSX
+ if (QFileInfo::exists(QCoreApplication::applicationDirPath() + "/../../../config.json")) {
+ applicationPath = QCoreApplication::applicationDirPath() + "/../../../";
+ } else {
+ applicationPath = QCoreApplication::applicationDirPath();
+ }
+#else
applicationPath = QCoreApplication::applicationDirPath();
+#endif
}
-
static const QString APPLICATION_CONFIG_FILENAME = "config.json";
QDir applicationDir(applicationPath);
QString configFileName = applicationDir.filePath(APPLICATION_CONFIG_FILENAME);
QFile configFile(configFileName);
QString launcherPath;
-
if (configFile.exists()) {
if (!configFile.open(QIODevice::ReadOnly)) {
qWarning() << "Found application config, but could not open it";
diff --git a/launchers/darwin/HQ Launcher.entitlements b/launchers/darwin/HQ Launcher.entitlements
new file mode 100644
index 0000000000..ddfcefe3af
--- /dev/null
+++ b/launchers/darwin/HQ Launcher.entitlements
@@ -0,0 +1,10 @@
+
+
+
+
+ com.apple.security.application-groups
+
+ high-fidelity.hifi
+
+
+
diff --git a/launchers/darwin/src/DownloadInterface.m b/launchers/darwin/src/DownloadInterface.m
index 09599d05c4..40c5e328de 100644
--- a/launchers/darwin/src/DownloadInterface.m
+++ b/launchers/darwin/src/DownloadInterface.m
@@ -50,6 +50,8 @@
repeats: YES];
NSError *error = nil;
NSFileManager *fileManager = [NSFileManager defaultManager];
+ Launcher* sharedLauncher = [Launcher sharedLauncher];
+ NSString* appPath = [sharedLauncher getAppPath];
NSString *destinationFileName = downloadTask.originalRequest.URL.lastPathComponent;
NSString* finalFilePath = [[[Launcher sharedLauncher] getAppPath] stringByAppendingPathComponent:destinationFileName];
NSURL *destinationURL = [NSURL URLWithString: [finalFilePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]] relativeToURL: [NSURL URLWithString:@"file://"]];
@@ -59,7 +61,12 @@
}
[fileManager moveItemAtURL:location toURL:destinationURL error:&error];
- Launcher* sharedLauncher = [Launcher sharedLauncher];
+ NSURL *oldInterfaceURL = [NSURL URLWithString: [[appPath stringByAppendingString:@"interface.app"] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]] relativeToURL: [NSURL URLWithString:@"file://"]];
+
+ if([fileManager fileExistsAtPath:[oldInterfaceURL path]])
+ {
+ [fileManager removeItemAtURL:oldInterfaceURL error:nil];
+ }
if (error) {
NSLog(@"Download Interface: failed to move file to destination -> error: %@", error);
@@ -68,7 +75,6 @@
return;
}
[sharedLauncher setDownloadFilename:destinationFileName];
- NSString* appPath = [sharedLauncher getAppPath];
NSString* downloadFileName = [sharedLauncher getDownloadFilename];
NSLog(@"extract interface zip");
diff --git a/launchers/darwin/src/Settings.m b/launchers/darwin/src/Settings.m
index cb9abe18b8..611e4313a1 100644
--- a/launchers/darwin/src/Settings.m
+++ b/launchers/darwin/src/Settings.m
@@ -14,19 +14,32 @@
return sharedSettings;
}
+- (NSString*) getOldFilePath {
+ Launcher* sharedLauncher = [Launcher sharedLauncher];
+ NSString* appPath = [sharedLauncher getAppPath];
+ NSString* filePath = [appPath stringByAppendingString:@"interface.app/Contents/MacOS/"];
+ return filePath;
+}
+
- (NSString*) getFilePath
{
Launcher* sharedLauncher = [Launcher sharedLauncher];
NSString* appPath = [sharedLauncher getAppPath];
- NSString* filePath = [appPath stringByAppendingString:@"interface.app/Contents/MacOS/"];
-
- return filePath;
+ return appPath;
}
- (void) readDataFromJsonFile
{
+ NSString* oldPath = [self getOldFilePath];
+ NSString* fileAtOldPath = [oldPath stringByAppendingString:@"config.json"];
NSString* filePath = [self getFilePath];
NSString* fileAtPath = [filePath stringByAppendingString:@"config.json"];
+
+ if ([[NSFileManager defaultManager] fileExistsAtPath:fileAtOldPath] && ![[NSFileManager defaultManager] fileExistsAtPath:fileAtPath]) {
+ BOOL success = [[NSFileManager defaultManager] moveItemAtPath:fileAtOldPath toPath:fileAtPath error:nil];
+ NSLog(@"move config to new location -> status: %@", success ? @"SUCCESS" : @"FAILED");
+ }
+
if ([[NSFileManager defaultManager] fileExistsAtPath:fileAtPath]) {
NSString* jsonString = [[NSString alloc] initWithData:[NSData dataWithContentsOfFile:fileAtPath] encoding:NSUTF8StringEncoding];
NSError * err;
@@ -34,7 +47,6 @@
NSDictionary * json;
if (data != nil) {
json = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err];
-
self.loggedIn = [[json valueForKey:@"loggedIn"] boolValue];
self.build = [[json valueForKey:@"build_version"] integerValue];
self.launcher = [json valueForKey:@"luancherPath"];
@@ -64,18 +76,18 @@
NSError * err;
NSData * jsonData = [NSJSONSerialization dataWithJSONObject:json options:0 error:&err];
NSString * jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
-
+
NSString* filePath = [self getFilePath];
NSString* fileAtPath = [filePath stringByAppendingString:@"config.json"];
-
+
if (![[NSFileManager defaultManager] fileExistsAtPath:fileAtPath]) {
NSError * error = nil;
[[NSFileManager defaultManager] createDirectoryAtPath:filePath withIntermediateDirectories:FALSE attributes:nil error:&error];
[[NSFileManager defaultManager] createFileAtPath:fileAtPath contents:nil attributes:nil];
-
+
}
[[jsonString dataUsingEncoding:NSUTF8StringEncoding] writeToFile:fileAtPath atomically:NO];
-
+
}
-(id)init