From 0a1d94639798a2cab2bd3693f8123fcefe000715 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Thu, 9 Aug 2018 13:16:00 +0200 Subject: [PATCH] use path to save json file (sellers) --- src/core/jsonutil.cpp | 4 ++-- src/core/jsonutil.h | 2 +- src/gui/mainwindow.cpp | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/jsonutil.cpp b/src/core/jsonutil.cpp index b4d9dc3..cb6de76 100644 --- a/src/core/jsonutil.cpp +++ b/src/core/jsonutil.cpp @@ -5,10 +5,10 @@ #include -void JsonUtil::exportSellers(const std::string& filename, Marketplace* market) +void JsonUtil::exportSellers(const std::filesystem::path& filePath, Marketplace* market) { Json::Value root; - std::ofstream file(filename); + std::ofstream file(filePath); Json::StreamWriterBuilder builder; builder["commentStyle"] = "None"; diff --git a/src/core/jsonutil.h b/src/core/jsonutil.h index d85d79f..3663dcc 100644 --- a/src/core/jsonutil.h +++ b/src/core/jsonutil.h @@ -9,7 +9,7 @@ class JsonUtil { public: - static void exportSellers(const std::string& filename, Marketplace* market); + static void exportSellers(const std::filesystem::path& filePath, Marketplace* market); static void importSellers(const std::filesystem::path& filePath, Marketplace* market); static void exportSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo); static void importSales(const std::filesystem::path& filePath, Marketplace* market, int cashPointNo); diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index d9a1da5..b643204 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -412,7 +412,9 @@ void MainWindow::onExportSellerJsonActionTriggered() if (filename.isEmpty()) return; - JsonUtil::exportSellers(filename.toStdString(), marketplace_.get()); + std::filesystem::path filePath(filename.toStdWString()); + + JsonUtil::exportSellers(filePath, marketplace_.get()); } void MainWindow::onExportSalesJsonActionTriggered()