[gnote] Use file read/write utilities in FuseSyncService
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Use file read/write utilities in FuseSyncService
- Date: Thu, 16 Feb 2017 11:11:54 +0000 (UTC)
commit a89fefbc31331094c1b8120c0d1f39cf54d2526b
Author: Aurimas Černius <aurisc4 gmail com>
Date: Thu Feb 16 12:55:02 2017 +0200
Use file read/write utilities in FuseSyncService
src/synchronization/fusesyncserviceaddin.cpp | 17 +++--------------
1 files changed, 3 insertions(+), 14 deletions(-)
---
diff --git a/src/synchronization/fusesyncserviceaddin.cpp b/src/synchronization/fusesyncserviceaddin.cpp
index 47ee871..e66aac9 100644
--- a/src/synchronization/fusesyncserviceaddin.cpp
+++ b/src/synchronization/fusesyncserviceaddin.cpp
@@ -17,8 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <fstream>
-
#include <glibmm/i18n.h>
#include <glibmm/miscutils.h>
#include <sigc++/signal.h>
@@ -137,12 +135,8 @@ bool FuseSyncServiceAddin::save_configuration()
}
// Test ability to create and write
- std::string testLine = "Testing write capabilities.";
- std::ofstream writer;
- writer.exceptions(std::ios_base::badbit|std::ios_base::failbit|std::ios_base::eofbit);
- writer.open(testPath.c_str());
- writer << testLine;
- writer.close();
+ Glib::ustring testLine = "Testing write capabilities.";
+ sharp::file_write_all_text(testPath, testLine);
// Test ability to read
bool testFileFound = false;
@@ -157,12 +151,7 @@ bool FuseSyncServiceAddin::save_configuration()
if(!testFileFound) {
throw GnoteSyncException(_("Could not read testfile."));
}
- std::ifstream reader;
- reader.exceptions(std::ios_base::badbit|std::ios_base::failbit);
- reader.open(testPath.c_str());
- std::string read_line;
- std::getline(reader, read_line);
- reader.close();
+ Glib::ustring read_line = sharp::file_read_all_text(testPath);
if(read_line != testLine) {
throw GnoteSyncException(_("Write test failed."));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]