[aseprite] 36/308: Don't print JSON output in STDOUT when we are in UI mode

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:44:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 47bb79bfe762bf81cc6ff77c175b4b857b0c9e3a
Author: David Capello <davidcapello at gmail.com>
Date:   Thu Dec 3 12:47:29 2015 -0300

    Don't print JSON output in STDOUT when we are in UI mode
    
    JSON output can be printed out into STDOUT only when we are in batch
    mode and the --sheet attribute isn't specified.
---
 src/app/document_exporter.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/app/document_exporter.cpp b/src/app/document_exporter.cpp
index ee5d4bb..a9ceb6f 100644
--- a/src/app/document_exporter.cpp
+++ b/src/app/document_exporter.cpp
@@ -342,9 +342,12 @@ Document* DocumentExporter::exportSheet()
 {
   // We output the metadata to std::cout if the user didn't specify a file.
   std::ofstream fos;
-  std::streambuf* osbuf;
-  if (m_dataFilename.empty())
-    osbuf = std::cout.rdbuf();
+  std::streambuf* osbuf = nullptr;
+  if (m_dataFilename.empty()) {
+    // Redirect to stdout if we are running in batch mode
+    if (!UIContext::instance()->isUIAvailable())
+      osbuf = std::cout.rdbuf();
+  }
   else {
     fos.open(FSTREAM_PATH(m_dataFilename), std::ios::out);
     osbuf = fos.rdbuf();
@@ -390,7 +393,8 @@ Document* DocumentExporter::exportSheet()
   renderTexture(samples, textureImage);
 
   // Save the metadata.
-  createDataFile(samples, os, textureImage);
+  if (osbuf)
+    createDataFile(samples, os, textureImage);
 
   // Save the image files.
   if (!m_textureFilename.empty()) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list