summaryrefslogtreecommitdiff
path: root/libs/ardour/plugin_manager.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-10-05 21:14:54 +0200
committerRobin Gareus <robin@gareus.org>2015-10-05 22:15:17 +0200
commitb9c8814959eb184fff3e5552e2928a156b62602d (patch)
tree894cefde9403e468e8c7833dea12e746c12d3233 /libs/ardour/plugin_manager.cc
parentc3b2cc46c5b5c0d53be4271a852cc07fd67ac046 (diff)
replace i/ofstream for plugin statues
Diffstat (limited to 'libs/ardour/plugin_manager.cc')
-rw-r--r--libs/ardour/plugin_manager.cc32
1 files changed, 14 insertions, 18 deletions
diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc
index 70fe198c72..11b34de209 100644
--- a/libs/ardour/plugin_manager.cc
+++ b/libs/ardour/plugin_manager.cc
@@ -28,6 +28,9 @@
#include <cstdlib>
#include <fstream>
+#include <glib.h>
+#include <pbd/gstdio_compat.h>
+
#ifdef HAVE_LRDF
#include <lrdf.h>
#endif
@@ -266,10 +269,11 @@ PluginManager::refresh (bool cache_only)
if (!cache_only) {
string fn = Glib::build_filename (ARDOUR::user_cache_directory(), VST_BLACKLIST);
if (Glib::file_test (fn, Glib::FILE_TEST_EXISTS)) {
- std::string bl;
- std::ifstream ifs (fn.c_str ());
- bl.assign ((std::istreambuf_iterator<char> (ifs)), (std::istreambuf_iterator<char> ()));
- PBD::info << _("VST Blacklist:") << "\n" << bl << "-----" << endmsg;
+ gchar *bl = NULL;
+ if (g_file_get_contents(fn.c_str (), contents, NULL, NULL)) {
+ PBD::info << _("VST Blacklist:") << "\n" << bl << "-----" << endmsg;
+ g_free (bl);
+ }
}
}
#endif
@@ -1005,14 +1009,8 @@ PluginManager::get_status (const PluginInfoPtr& pi)
void
PluginManager::save_statuses ()
{
- ofstream ofs;
std::string path = Glib::build_filename (user_config_directory(), "plugin_statuses");
-
- ofs.open (path.c_str(), ios_base::openmode (ios::out|ios::trunc));
-
- if (!ofs) {
- return;
- }
+ stringstream ofs;
for (PluginStatusList::iterator i = statuses.begin(); i != statuses.end(); ++i) {
switch ((*i).type) {
@@ -1051,19 +1049,19 @@ PluginManager::save_statuses ()
ofs << (*i).unique_id;;
ofs << endl;
}
-
- ofs.close ();
+ g_file_set_contents (path.c_str(), ofs.str().c_str(), -1, NULL);
}
void
PluginManager::load_statuses ()
{
std::string path = Glib::build_filename (user_config_directory(), "plugin_statuses");
- ifstream ifs (path.c_str());
-
- if (!ifs) {
+ gchar *fbuf = NULL;
+ if (!g_file_get_contents (path.c_str(), &fbuf, NULL, NULL)) {
return;
}
+ stringstream ifs (fbuf);
+ g_free (fbuf);
std::string stype;
std::string sstatus;
@@ -1126,8 +1124,6 @@ PluginManager::load_statuses ()
strip_whitespace_edges (id);
set_status (type, id, status);
}
-
- ifs.close ();
}
void