[gnote] Move destination directory creation to separate virtual method



commit aab6de3f6ef781c46813cdbdb86d5b98b345e05c
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Feb 6 13:46:50 2021 +0200

    Move destination directory creation to separate virtual method

 src/synchronization/filesystemsyncserver.cpp | 14 ++++++++++----
 src/synchronization/filesystemsyncserver.hpp |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/synchronization/filesystemsyncserver.cpp b/src/synchronization/filesystemsyncserver.cpp
index c9cba44f..84713349 100644
--- a/src/synchronization/filesystemsyncserver.cpp
+++ b/src/synchronization/filesystemsyncserver.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013,2017-2020 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017-2021 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
@@ -86,11 +86,17 @@ void FileSystemSyncServer::common_ctor()
 }
 
 
-void FileSystemSyncServer::upload_notes(const std::vector<Note::Ptr> & notes)
+void FileSystemSyncServer::mkdir_p(const Glib::RefPtr<Gio::File> & path)
 {
-  if(sharp::directory_exists(m_new_revision_path) == false) {
-    sharp::directory_create(m_new_revision_path);
+  if(sharp::directory_exists(path) == false) {
+    sharp::directory_create(path);
   }
+}
+
+
+void FileSystemSyncServer::upload_notes(const std::vector<Note::Ptr> & notes)
+{
+  mkdir_p(m_new_revision_path);
   DBG_OUT("UploadNotes: notes.Count = %d", int(notes.size()));
   m_updated_notes.reserve(notes.size());
   Glib::Mutex notes_lock;
diff --git a/src/synchronization/filesystemsyncserver.hpp b/src/synchronization/filesystemsyncserver.hpp
index cf86adf6..47300afc 100644
--- a/src/synchronization/filesystemsyncserver.hpp
+++ b/src/synchronization/filesystemsyncserver.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2012-2013,2017-2020 Aurimas Cernius
+ * Copyright (C) 2012-2013,2017-2021 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
@@ -47,6 +47,8 @@ public:
   virtual SyncLockInfo current_sync_lock() override;
   virtual Glib::ustring id() override;
   virtual bool updates_available_since(int revision) override;
+protected:
+  virtual void mkdir_p(const Glib::RefPtr<Gio::File> & path);
 private:
   void common_ctor();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]