[gnote] Use file reading utility in NoteDirectoryWatcher



commit bb2e4af1585386f432be3bcc668408ff1f7951f4
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Thu Feb 16 12:58:49 2017 +0200

    Use file reading utility in NoteDirectoryWatcher

 .../notedirectorywatcherapplicationaddin.cpp       |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)
---
diff --git a/src/addins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp 
b/src/addins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
index c367e0b..7467d98 100644
--- a/src/addins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
+++ b/src/addins/notedirectorywatcher/notedirectorywatcherapplicationaddin.cpp
@@ -18,8 +18,6 @@
  */
 
 
-#include <fstream>
-
 #include <glibmm/i18n.h>
 
 #include "debug.hpp"
@@ -221,16 +219,9 @@ void NoteDirectoryWatcherApplicationAddin::add_or_update_note(const Glib::ustrin
 
   Glib::ustring noteXml;
   try {
-    std::ifstream reader;
-    reader.exceptions(std::ios_base::badbit);
-    reader.open(note_path.c_str());
-    std::string line;
-    while(std::getline(reader, line)) {
-      noteXml += line + '\n';
-    }
-    reader.close();
+    noteXml = sharp::file_read_all_text(note_path);
   }
-  catch(std::ios::failure & e) {
+  catch(sharp::Exception & e) {
     /* TRANSLATORS: first %s is file name, second is error */
     ERR_OUT(_("NoteDirectoryWatcher: Update aborted, error reading %s: %s"), note_path.c_str(), e.what());
     return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]