Browse Source

atomic-cli activation & deactivation working on Windows

Josh Engebretson 10 years ago
parent
commit
120306b9a8

+ 1 - 0
.gitignore

@@ -1,5 +1,6 @@
 
 
 *.user
 *.user
+*.log
 Bin/Atomic.d.ts
 Bin/Atomic.d.ts
 Bin/Atomic.js
 Bin/Atomic.js
 Bin/*.pak
 Bin/*.pak

+ 1 - 1
CLI/atomic-cli/lib/atomictool.js

@@ -87,7 +87,7 @@ var run = function (platform, opts) {
 var exec = function (command, flags, opts) {
 var exec = function (command, flags, opts) {
     opts = opts || {};
     opts = opts || {};
     if (opts.verbose !== false) {
     if (opts.verbose !== false) {
-        console.log([command].concat(flags).join(" "));
+        //console.log([command].concat(flags).join(" "));
     }
     }
 
 
     var deferred = Q.defer();
     var deferred = Q.defer();

+ 1 - 1
Source/Atomic/Engine/Application.h

@@ -50,7 +50,7 @@ public:
     /// Initialize the engine and run the main loop, then return the application exit code. Catch out-of-memory exceptions while running.
     /// Initialize the engine and run the main loop, then return the application exit code. Catch out-of-memory exceptions while running.
     int Run();
     int Run();
     /// Show an error message (last log message if empty), terminate the main loop, and set failure exit code.
     /// Show an error message (last log message if empty), terminate the main loop, and set failure exit code.
-    void ErrorExit(const String& message = String::EMPTY);
+    virtual void ErrorExit(const String& message = String::EMPTY);
 
 
 protected:
 protected:
     /// Handle log message.
     /// Handle log message.

+ 18 - 0
Source/AtomicTool/AtomicTool.cpp

@@ -280,6 +280,24 @@ void AtomicTool::Stop()
 
 
 }
 }
 
 
+void AtomicTool::ErrorExit(const String& message)
+{
+    engine_->Exit(); // Close the rendering window
+    exitCode_ = EXIT_FAILURE;
+
+    // Only for WIN32, otherwise the error messages would be double posted on Mac OS X and Linux platforms
+    if (!message.Length())
+    {
+        #ifdef WIN32
+        Atomic::ErrorExit(startupErrors_.Length() ? startupErrors_ :
+            "Application has been terminated due to unexpected error.", exitCode_);
+        #endif
+    }
+    else
+        Atomic::ErrorExit(message, exitCode_);
+}
+
+
 
 
 }
 }
 
 

+ 2 - 0
Source/AtomicTool/AtomicTool.h

@@ -28,6 +28,8 @@ public:
     /// Cleanup after the main loop. Run the script's stop function if it exists.
     /// Cleanup after the main loop. Run the script's stop function if it exists.
     virtual void Stop();
     virtual void Stop();
 
 
+    void ErrorExit(const String& message = String::EMPTY);
+
 private:
 private:
 
 
     void HandleLicenseEulaRequired(StringHash eventType, VariantMap& eventData);
     void HandleLicenseEulaRequired(StringHash eventType, VariantMap& eventData);

+ 2 - 2
Source/AtomicTool/CMakeLists.txt

@@ -1,10 +1,10 @@
 set (ATOMIC_TOOL_SOURCES AtomicTool.cpp AtomicTool.h)
 set (ATOMIC_TOOL_SOURCES AtomicTool.cpp AtomicTool.h)
 
 
 if (MSVC)
 if (MSVC)
-    set (EXE_TYPE WIN32)
+    add_definitions(-DATOMIC_WIN32_CONSOLE)
 endif()
 endif()
 
 
-add_executable(AtomicTool ${EXE_TYPE} ${ATOMIC_TOOL_SOURCES})
+add_executable(AtomicTool ${ATOMIC_TOOL_SOURCES})
 
 
 target_link_libraries(AtomicTool ${ATOMIC_LINK_LIBRARIES} ToolCore Poco)
 target_link_libraries(AtomicTool ${ATOMIC_LINK_LIBRARIES} ToolCore Poco)