[gnote] Remove temp note directories
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Remove temp note directories
- Date: Mon, 6 Apr 2020 17:18:34 +0000 (UTC)
commit 2e7d6b0b47ce1f9d001d623bf7df332a22a2731b
Author: Aurimas Černius <aurisc4 gmail com>
Date: Mon Apr 6 20:16:58 2020 +0300
Remove temp note directories
src/test/testnotemanager.cpp | 12 +++++++++++-
src/test/testnotemanager.hpp | 3 ++-
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/test/testnotemanager.cpp b/src/test/testnotemanager.cpp
index 6dcb6988..8c88c59c 100644
--- a/src/test/testnotemanager.cpp
+++ b/src/test/testnotemanager.cpp
@@ -20,13 +20,18 @@
#include "testnote.hpp"
#include "testnotemanager.hpp"
+
+// defined in syncmanagerutests.cpp
+void remove_dir(const Glib::ustring dir);
+
+
namespace test {
Glib::ustring NoteManager::test_notes_dir()
{
char notes_dir_tmpl[] = "/tmp/gnotetestnotesXXXXXX";
char *notes_dir = g_mkdtemp(notes_dir_tmpl);
- return Glib::ustring(notes_dir) + "/notes";
+ return notes_dir;
}
@@ -39,6 +44,11 @@ NoteManager::NoteManager(const Glib::ustring & notesdir, gnote::IGnote & g)
init(notesdir, backup);
}
+NoteManager::~NoteManager()
+{
+ remove_dir(notes_dir());
+}
+
gnote::NoteBase::Ptr NoteManager::note_create_new(const Glib::ustring & title, const Glib::ustring &
file_name)
{
auto note_data = std::make_unique<gnote::NoteData>(gnote::NoteBase::url_from_path(file_name));
diff --git a/src/test/testnotemanager.hpp b/src/test/testnotemanager.hpp
index 1235289f..f6002f3f 100644
--- a/src/test/testnotemanager.hpp
+++ b/src/test/testnotemanager.hpp
@@ -1,7 +1,7 @@
/*
* gnote
*
- * Copyright (C) 2014,2019 Aurimas Cernius
+ * Copyright (C) 2014,2019-2020 Aurimas Cernius
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +32,7 @@ public:
static Glib::ustring test_notes_dir();
NoteManager(const Glib::ustring & notes_dir, gnote::IGnote & g);
+ virtual ~NoteManager();
virtual gnote::notebooks::NotebookManager & notebook_manager() override
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]