changeset 690:eec59baf5bee

Added some more debug log outputs to the IndentHandler. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@959 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Thu, 28 May 2009 10:18:34 +0000
parents 54e393430558
children 2af225b848bb
files src/IndentHandler.cpp
diffstat 1 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/IndentHandler.cpp	Thu May 28 10:17:09 2009 +0000
+++ b/src/IndentHandler.cpp	Thu May 28 10:18:34 2009 +0000
@@ -411,9 +411,14 @@
     QFile::remove(tempDirctoryStr + "/" + inputFileName + inputFileExtension);
     QFile inputSrcFile(tempDirctoryStr + "/" + inputFileName + inputFileExtension);
     // Write the source code to the input file for the indenter
-    inputSrcFile.open( QFile::ReadWrite | QFile::Text );
-    inputSrcFile.write( sourceCode.toUtf8() );
-    inputSrcFile.close();
+    if ( inputSrcFile.open( QFile::ReadWrite | QFile::Text ) ) {
+        inputSrcFile.write( sourceCode.toUtf8() );
+        inputSrcFile.close();
+        qDebug() << __LINE__ << " " << __FUNCTION__ << ": Wrote to be indented source code to file " << inputSrcFile.fileName();
+    }
+    else {
+        qCritical() << __LINE__ << " " << __FUNCTION__ << ": Couldn't write to be indented source code to file " << inputSrcFile.fileName();
+    }
 
     // Set the input file for the to be called indenter.
     if ( inputFileParameter.trimmed() == "<" || inputFileParameter == "stdin" ) {
@@ -511,6 +516,8 @@
     // Set the directory for the indenter execution
     indentProcess.setWorkingDirectory( QFileInfo(tempDirctoryStr).absoluteFilePath() );
 
+    qDebug() << __LINE__ << " " << __FUNCTION__ << ": Will call the indenter in the directory " << QFileInfo(tempDirctoryStr).absoluteFilePath() << " using this commandline call: " << indenterCompleteCallString;
+
     indentProcess.start(indenterCompleteCallString);
 
     processReturnString = "";
@@ -570,15 +577,21 @@
         // If the indenter results are written to stdout, read them from there...
         if ( indentProcess.exitCode() == 0 && outputFileParameter == "stdout"  ) {
             formattedSourceCode = indentProcess.readAllStandardOutput();
+            qDebug() << __LINE__ << " " << __FUNCTION__ << ": Read indenter output from StdOut.";
         }
         // ... else read the output file generated by the indenter call.
         else {
             QFile outSrcFile(tempDirctoryStr + "/" + outputFileName + inputFileExtension);
-            outSrcFile.open(QFile::ReadOnly | QFile::Text);
-            QTextStream outSrcStrm(&outSrcFile);
-            outSrcStrm.setCodec( QTextCodec::codecForName("UTF-8") );
-            formattedSourceCode = outSrcStrm.readAll();
-            outSrcFile.close();
+            if ( outSrcFile.open(QFile::ReadOnly | QFile::Text) ) {
+                QTextStream outSrcStrm(&outSrcFile);
+                outSrcStrm.setCodec( QTextCodec::codecForName("UTF-8") );
+                formattedSourceCode = outSrcStrm.readAll();
+                outSrcFile.close();
+                qDebug() << __LINE__ << " " << __FUNCTION__ << ": Read indenter output from file " << outSrcFile.fileName();
+            }
+            else {
+                qCritical() << __LINE__ << " " << __FUNCTION__ << ": Couldn't read indenter output from file " << outSrcFile.fileName();
+            }
         }
     }
     else {