#include <algorithm>
#include <pbd/error.h>
#include <ardour/configuration.h>
+#include <ardour/filesystem_paths.h>
#include <ardour/recent_sessions.h>
#include <ardour/utils.h>
-#include "i18n.h"
+#include "i18n.h"
using namespace std;
using namespace ARDOUR;
+using namespace PBD;
+
+namespace {
+
+ const char * const recent_file_name = "recent";
+
+} // anonymous
int
ARDOUR::read_recent_sessions (RecentSessions& rs)
{
- string path = Config->get_user_ardour_path();
- path += "/recent";
+ sys::path recent_file_path(user_config_directory());
+
+ recent_file_path /= recent_file_name;
+
+ const string path = recent_file_path.to_string();
ifstream recent (path.c_str());
if (!recent) {
if (errno != ENOENT) {
- error << compose (_("cannot open recent session file %1 (%2)"), path, strerror (errno)) << endmsg;
+ error << string_compose (_("cannot open recent session file %1 (%2)"), path, strerror (errno)) << endmsg;
return -1;
} else {
return 1;
int
ARDOUR::write_recent_sessions (RecentSessions& rs)
{
- string path = Config->get_user_ardour_path();
- path += "/recent";
+ sys::path recent_file_path(user_config_directory());
+
+ recent_file_path /= recent_file_name;
+
+ const string path = recent_file_path.to_string();
ofstream recent (path.c_str());