Browse Source

Basic initialization of Mac sandbox without extended profile

pull/638/head
Jon Williams 7 years ago
parent
commit
e76bab7644
3 changed files with 35 additions and 0 deletions
  1. +5
    -0
      include/sandbox.hpp
  2. +2
    -0
      src/main.cpp
  3. +28
    -0
      src/sandbox.cpp

+ 5
- 0
include/sandbox.hpp View File

@@ -0,0 +1,5 @@
#pragma once

namespace rack {
bool sandboxInit();
}

+ 2
- 0
src/main.cpp View File

@@ -1,6 +1,7 @@
#include "engine.hpp"
#include "gui.hpp"
#include "app.hpp"
#include "sandbox.hpp"
#include "plugin.hpp"
#include "settings.hpp"
#include "asset.hpp"
@@ -31,6 +32,7 @@ int main(int argc, char* argv[]) {
info("Local directory: %s", localDir.c_str());
}

sandboxInit();
pluginInit();
engineInit();
guiInit();


+ 28
- 0
src/sandbox.cpp View File

@@ -0,0 +1,28 @@
#include "sandbox.hpp"
#include "util.hpp"
namespace rack {
#if defined(ARCH_MAC)
#include <sandbox.h>

bool sandboxInit() {
char* error_buff = NULL;
//int error = sandbox_init(final_sandbox_profile_str.c_str(), 0, &error_buff);
int error = sandbox_init(kSBXProfileNoInternet, SANDBOX_NAMED, &error_buff);
bool success = (error == 0 && error_buff == NULL);
if(!success) {
info("Sandbox initialization error (%d): %s", error, error_buff);
} else {
info("Sandbox initialized!");
}
sandbox_free_error(error_buff);

return success;
}


#else
bool sandboxInit() {
return false;
}
#endif
}

Loading…
Cancel
Save