I was just implementing the OS X version of my .NET app.
After starting I was presented with the following error.
- Code: Select all
0421/124121:FATAL:main_delegate.cc(53)] Check failed: path.BaseName().value() == "Contents" (Debug vs. Contents)
Backtrace:
0 libcef.dylib 0x053a012f base::debug::StackTrace::StackTrace() + 63
1 libcef.dylib 0x053a00cb base::debug::StackTrace::StackTrace() + 43
2 libcef.dylib 0x053ee4ec logging::LogMessage::~LogMessage() + 76
3 libcef.dylib 0x053ecfeb logging::LogMessage::~LogMessage() + 43
4 libcef.dylib 0x0631fa18 (anonymous namespace)::GetFrameworksPath() + 600
5 libcef.dylib 0x0631e026 (anonymous namespace)::OverrideFrameworkBundlePath() + 38
6 libcef.dylib 0x0631d4bb CefMainDelegate::BasicStartupComplete(int*) + 59
7 libcef.dylib 0x04848b38 (anonymous namespace)::ContentMainRunnerImpl::Initialize(int, char const**, content::ContentMainDelegate*) + 408
8 libcef.dylib 0x062c8ee5 CefContext::Initialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>) + 853
9 libcef.dylib 0x062c8ae5 CefInitialize(CefMainArgs const&, CefStructBase<CefSettingsTraits> const&, CefRefPtr<CefApp>) + 469
10 libcef.dylib 0x047d7d37 cef_initialize + 695
11 ??? 0x02a7f843 0x0 + 44562499
12 ??? 0x02a7da80 0x0 + 44554880
13 ??? 0x02a7b3d8 0x0 + 44544984
14 ??? 0x02a7aa7c 0x0 + 44542588
15 ??? 0x02a7a968 0x0 + 44542312
16 ??? 0x026ad755 0x0 + 40556373
17 ??? 0x026c31ac 0x0 + 40645036
18 AppKit 0x93a91261 NSApplicationMain + 1054
19 ??? 0x026c3656 0x0 + 40646230
20 ??? 0x026c3454 0x0 + 40645716
21 ??? 0x00556ff8 0x0 + 5599224
22 ??? 0x00557156 0x0 + 5599574
23 Crystalbyte.Chocolate.Application.Mac 0x0000ecf4 mono_jit_runtime_invoke + 164
24 Crystalbyte.Chocolate.Application.Mac 0x00184354 mono_runtime_invoke + 68
25 Crystalbyte.Chocolate.Application.Mac 0x0018a41e mono_runtime_exec_main + 238
26 Crystalbyte.Chocolate.Application.Mac 0x0007464d mono_main + 6797
27 Crystalbyte.Chocolate.Application.Mac 0x00001fd6 start + 54
The implementation within the main_delegate.cc makes assumptions that are not necessarily true, the root path is not always the executable path. Many frameworks as in Python, Mono need to make adjustments to the "regular" path structure in order to work properly, otherwise the mono or python executable would remain the entry point, in my case a symlink at the app bundle is the entry point.
Instead of hardcoding any possible entry point assumptions I suggest using the NSBundle class to determine the file structure starting at the bundle root.
The NSBundle keeps references to all important paths including BundlePath, ExecutablePath, PrivateFrameworksPath and ResourcePath, eliminating any dir tree walks thus removing any assumptions about the entry point.
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html