[gnote] Use file_read_all_text in SyncUtils
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Use file_read_all_text in SyncUtils
- Date: Thu, 16 Feb 2017 11:11:28 +0000 (UTC)
commit f89789f318cc30abaa39920d40f78e3ce36aed27
Author: Aurimas Černius <aurisc4 gmail com>
Date: Thu Feb 16 12:00:11 2017 +0200
Use file_read_all_text in SyncUtils
src/synchronization/syncutils.cpp | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/src/synchronization/syncutils.cpp b/src/synchronization/syncutils.cpp
index fbeba74..1b5d46e 100644
--- a/src/synchronization/syncutils.cpp
+++ b/src/synchronization/syncutils.cpp
@@ -19,7 +19,6 @@
#include <algorithm>
-#include <fstream>
#include <vector>
#include <glibmm.h>
@@ -116,16 +115,9 @@ namespace sync {
bool SyncUtils::is_fuse_enabled()
{
try {
- std::string fsFileName = "/proc/filesystems";
+ Glib::ustring fsFileName = "/proc/filesystems";
if(sharp::file_exists(fsFileName)) {
- std::string fsOutput;
- std::ifstream file(fsFileName.c_str());
- while(file) {
- std::string line;
- std::getline(file, line);
- fsOutput += "\n" + line;
- }
- file.close();
+ Glib::ustring fsOutput = sharp::file_read_all_text(fsFileName);
Glib::RefPtr<Glib::Regex> re = Glib::Regex::create("\\s+fuse\\s+", Glib::REGEX_MULTILINE);
return re->match(fsOutput);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]