mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
Use glib to open our 'announcements' file, rather than opening directly with ofstream
(on Windows, std::ofstream doesn't support UTF8)
This commit is contained in:
parent
d11b15fbca
commit
d0fdcf2848
2 changed files with 28 additions and 12 deletions
|
|
@ -808,7 +808,11 @@ ARDOUR_UI::check_announcements ()
|
||||||
_annc_filename.append (VERSIONSTRING);
|
_annc_filename.append (VERSIONSTRING);
|
||||||
|
|
||||||
std::string path = Glib::build_filename (user_config_directory(), _annc_filename);
|
std::string path = Glib::build_filename (user_config_directory(), _annc_filename);
|
||||||
std::ifstream announce_file (path.c_str());
|
FILE* fin = g_fopen (path.c_str(), "rb");
|
||||||
|
|
||||||
|
if (fin) {
|
||||||
|
std::ifstream announce_file (fin);
|
||||||
|
|
||||||
if ( announce_file.fail() )
|
if ( announce_file.fail() )
|
||||||
_announce_string = "";
|
_announce_string = "";
|
||||||
else {
|
else {
|
||||||
|
|
@ -817,6 +821,9 @@ ARDOUR_UI::check_announcements ()
|
||||||
_announce_string = oss.str();
|
_announce_string = oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose (fin);
|
||||||
|
}
|
||||||
|
|
||||||
pingback (VERSIONSTRING, path);
|
pingback (VERSIONSTRING, path);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
#include <glib/gstdio.h>
|
||||||
#include <glibmm/miscutils.h>
|
#include <glibmm/miscutils.h>
|
||||||
|
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
|
|
@ -222,12 +223,20 @@ _pingback (void *arg)
|
||||||
//write announcements to local file, even if the
|
//write announcements to local file, even if the
|
||||||
//announcement is empty
|
//announcement is empty
|
||||||
|
|
||||||
std::ofstream annc_file (cm->announce_path.c_str());
|
FILE* fout = g_fopen (cm->announce_path.c_str(), "wb");
|
||||||
|
|
||||||
|
if (fout) {
|
||||||
|
{
|
||||||
|
std::ofstream annc_file (fout);
|
||||||
|
|
||||||
if (annc_file) {
|
if (annc_file) {
|
||||||
annc_file << return_str;
|
annc_file << return_str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose (fout);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "curl failed: " << errbuf << std::endl;
|
std::cerr << "curl failed: " << errbuf << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue