Commit f9d48b7fad03ea11a009a40910457534ca4b9684

Authored by Josh Klontz
1 parent 39dd2e34

csvOutput now uses QtUtils::writeFile

sdk/plugins/output.cpp
@@ -57,21 +57,15 @@ class csvOutput : public MatrixOutput @@ -57,21 +57,15 @@ class csvOutput : public MatrixOutput
57 ~csvOutput() 57 ~csvOutput()
58 { 58 {
59 if (file.isNull() || targetFiles.isEmpty() || queryFiles.isEmpty()) return; 59 if (file.isNull() || targetFiles.isEmpty() || queryFiles.isEmpty()) return;
60 - QFile out(file);  
61 - bool success = out.open(QFile::WriteOnly);  
62 - if (!success) qFatal("Output::saveCSV failed to open %s for writing.", qPrintable((QString)file));  
63 - out.write("File,");  
64 - out.write(qPrintable(targetFiles.names().join(",")));  
65 - out.write("\n"); 60 + QStringList lines;
  61 + lines.append("File," + targetFiles.names().join(","));
66 for (int i=0; i<queryFiles.size(); i++) { 62 for (int i=0; i<queryFiles.size(); i++) {
67 - out.write(qPrintable(queryFiles[i].name));  
68 - for (int j=0; j<targetFiles.size(); j++) {  
69 - out.write(",");  
70 - out.write(qPrintable(toString(i,j)));  
71 - }  
72 - out.write("\n"); 63 + QStringList words;
  64 + for (int j=0; j<targetFiles.size(); j++)
  65 + words.append(toString(i,j));
  66 + lines.append(queryFiles[i].name+","+words.join(","));
73 } 67 }
74 - out.close(); 68 + QtUtils::writeFile(file, lines);
75 } 69 }
76 }; 70 };
77 71
1 -Subproject commit a9f2dc47856fe05efb49f5c2f6367f5fb65aca71 1 +Subproject commit d446cb37c75632fb50af0c5c43bee55584b08107