summaryrefslogtreecommitdiff
path: root/gtk2_ardour/startup.cc
diff options
context:
space:
mode:
authorJohn Emmas <johne53@tiscali.co.uk>2015-09-05 18:02:32 +0100
committerJohn Emmas <johne53@tiscali.co.uk>2015-09-05 18:02:32 +0100
commit03163154a2a909d3f41f4a0edb88b0ad640dad97 (patch)
treea62c2bd5cc5590df1a5979c5b88eb76f2e07392f /gtk2_ardour/startup.cc
parent0b2af5b9b89f2cda6921b82517f4560b91ef05c2 (diff)
As an experiment, use PBD::ScopedFileDescriptor in preference to 'ofstream' which doesn't support UTF8 (on Windows at least)
This change should ensure that our "been_here_before" file ('.a3' or whatever) will get created successfully - even for user paths with non-English characters in them. If this experiment works on all platforms, there are several other areas where we'll probably need something similar.
Diffstat (limited to 'gtk2_ardour/startup.cc')
-rw-r--r--gtk2_ardour/startup.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/gtk2_ardour/startup.cc b/gtk2_ardour/startup.cc
index 719e94f241..f3e1808a9c 100644
--- a/gtk2_ardour/startup.cc
+++ b/gtk2_ardour/startup.cc
@@ -24,11 +24,15 @@
#include <fstream>
#include <algorithm>
+#include <fcntl.h>
+
+#include <glib/gstdio.h>
#include <gtkmm/main.h>
#include <gtkmm/filechooser.h>
#include "pbd/failed_constructor.h"
+#include "pbd/scoped_file_descriptor.h"
#include "pbd/file_utils.h"
#include "pbd/replace_all.h"
#include "pbd/whitespace.h"
@@ -126,7 +130,7 @@ ArdourStartup::required ()
if (Glib::file_test (ARDOUR::been_here_before_path (v), Glib::FILE_TEST_EXISTS)) {
if (v != current_version) {
/* older version exists, create the current one */
- ofstream fout (been_here_before_path (current_version).c_str());
+ PBD::ScopedFileDescriptor fout (g_open (been_here_before_path (current_version).c_str(), O_CREAT|O_TRUNC|O_RDWR, 0666));
}
return false;
}
@@ -418,7 +422,7 @@ ArdourStartup::on_apply ()
/* "touch" the been-here-before path now we've successfully
made it through the first time setup (at least)
*/
- ofstream fout (been_here_before_path().c_str());
+ PBD::ScopedFileDescriptor fout (g_open (been_here_before_path ().c_str(), O_CREAT|O_TRUNC|O_RDWR, 0666));
}