- /* works even if it has not been opened */
- ofile.close ();
-
- if (ret) {
- g_remove (tmp_path.c_str());
- } else if (!path.empty()) {
- /* move the data file to the requested path */
- g_rename (tmp_path.c_str(), path.c_str());
+ if (!ret) {
+ g_file_set_contents (path.c_str(), outss.str().c_str(), -1, NULL);