Fix entry function under Linux.

This commit is contained in:
Cheng Zhao 2013-12-31 11:51:17 +00:00
parent 627f487b36
commit 7afef0fcdb

View file

@ -20,9 +20,12 @@
#include "common/crash_reporter/win/crash_service_main.h" #include "common/crash_reporter/win/crash_service_main.h"
#include "content/public/app/startup_helper_win.h" #include "content/public/app/startup_helper_win.h"
#include "sandbox/win/src/sandbox_types.h" #include "sandbox/win/src/sandbox_types.h"
#else // defined(OS_WIN) #elif defined(OS_LINUX) // defined(OS_WIN)
#include "app/atom_main_delegate.h" // NOLINT
#include "content/public/app/content_main.h"
#else // defined(OS_LINUX)
#include "app/atom_library_main.h" #include "app/atom_library_main.h"
#endif // defined(OS_MACOSX) || defined(OS_LINUX) #endif // defined(OS_MACOSX)
// Declaration of node::Start. // Declaration of node::Start.
namespace node { namespace node {
@ -98,7 +101,18 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
return content::ContentMain(instance, &sandbox_info, &delegate); return content::ContentMain(instance, &sandbox_info, &delegate);
} }
#else // defined(OS_WIN) #elif defined(OS_LINUX) // defined(OS_WIN)
int main(int argc, const char* argv[]) {
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0)
return node::Start(argc, const_cast<char**>(argv));
atom::AtomMainDelegate delegate;
return content::ContentMain(argc, argv, &delegate);
}
#else // defined(OS_LINUX)
int main(int argc, const char* argv[]) { int main(int argc, const char* argv[]) {
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE"); char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
@ -108,4 +122,4 @@ int main(int argc, const char* argv[]) {
return AtomMain(argc, argv); return AtomMain(argc, argv);
} }
#endif // defined(OS_MACOSX) || defined(OS_LINUX) #endif // defined(OS_MACOSX)