#include <sys/types.h>
#include <cstdio>
#include <cstdlib>
-#include <fstream>
+
+#include <glib.h>
+#include "pbd/gstdio_compat.h"
#ifdef HAVE_LRDF
#include <lrdf.h>
#include <cstring>
#endif //LXVST_SUPPORT
-#include <glib/gstdio.h>
#include <glibmm/miscutils.h>
#include <glibmm/pattern.h>
#include <glibmm/fileutils.h>
#ifdef PLATFORM_WINDOWS
// on windows the .exe needs to be in the same folder with libardour.dll
- vstsp += Glib::build_filename(g_win32_get_package_installation_directory_of_module (0), "bin");
+ vstsp += Glib::build_filename(windows_package_directory_path(), "bin");
#else
// on Unices additional internal-use binaries are deployed to $libdir
vstsp += ARDOUR::ardour_dll_directory();
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 (), &bl, NULL, NULL)) {
+ PBD::info << _("VST Blacklist:") << "\n" << bl << "-----" << endmsg;
+ g_free (bl);
+ }
}
}
#endif
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) {
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;
strip_whitespace_edges (id);
set_status (type, id, status);
}
-
- ifs.close ();
}
void