summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.includes.imp1
-rw-r--r--include/ingen/FilePath.hpp108
-rw-r--r--include/ingen/Node.hpp8
-rw-r--r--include/ingen/URI.hpp6
-rw-r--r--include/ingen/filesystem.hpp84
-rw-r--r--src/Configuration.cpp7
-rw-r--r--src/FilePath.cpp247
-rw-r--r--src/Parser.cpp8
-rw-r--r--src/Serialiser.cpp10
-rw-r--r--src/World.cpp3
-rw-r--r--src/gui/ThreadedLoader.cpp4
-rw-r--r--src/meson.build1
-rw-r--r--src/runtime_paths.cpp5
-rw-r--r--src/server/LV2Block.hpp6
-rw-r--r--src/server/events/Copy.cpp1
-rw-r--r--src/server/events/Delete.cpp1
-rw-r--r--src/server/events/Delta.cpp1
-rw-r--r--tests/ingen_test.cpp9
-rw-r--r--tests/meson.build1
-rw-r--r--tests/tst_FilePath.cpp108
20 files changed, 44 insertions, 575 deletions
diff --git a/.includes.imp b/.includes.imp
index 7fa08fcb..b01a29bf 100644
--- a/.includes.imp
+++ b/.includes.imp
@@ -20,6 +20,7 @@
"<boost/intrusive/options.hpp>", "public" ] },
{ "include": [ "<bits/chrono.h>", "private", "<chrono>", "public", ] },
+ { "include": [ "<bits/utility.h>", "private", "<utility>", "public", ] },
{ "include": [ "<ext/alloc_traits.h>", "private", "<string>", "public", ] },
{ "include": [ "<ext/alloc_traits.h>", "private", "<vector>", "public", ] },
{ "include": [ "<gdk/gdkevents.h>", "private", "<gdk/gdk.h>", "public", ] },
diff --git a/include/ingen/FilePath.hpp b/include/ingen/FilePath.hpp
index 6f0266a7..ce157d90 100644
--- a/include/ingen/FilePath.hpp
+++ b/include/ingen/FilePath.hpp
@@ -1,6 +1,6 @@
/*
This file is part of Ingen.
- Copyright 2018 David Robillard <http://drobilla.net/>
+ Copyright 2018-2020 David Robillard <http://drobilla.net/>
Ingen is free software: you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
@@ -17,113 +17,11 @@
#ifndef INGEN_FILEPATH_HPP
#define INGEN_FILEPATH_HPP
-#include "ingen/ingen.h"
-
-#include <boost/utility/string_view.hpp> // IWYU pragma: export
-
-#include <cstddef>
-#include <ostream>
-#include <string>
-#include <utility>
-
-#ifndef USE_WINDOWS_FILE_PATHS
-# if defined(_WIN32) && !defined(__CYGWIN__)
-# define USE_WINDOWS_FILE_PATHS 1
-# else
-# define USE_WINDOWS_FILE_PATHS 0
-# endif
-#endif
+#include <filesystem>
namespace ingen {
-/** A path to a file.
- *
- * This is a minimal subset of the std::filesystem::path interface in C++17.
- * Support for Windows paths is only partial and there is no support for
- * character encoding conversion at all.
- */
-class INGEN_API FilePath
-{
-public:
-#if USE_WINDOWS_FILE_PATHS
- using value_type = wchar_t;
- static constexpr value_type preferred_separator = L'\\';
-#else
- using value_type = char;
- static constexpr value_type preferred_separator = '/';
-#endif
-
- using string_type = std::basic_string<value_type>;
-
- FilePath() = default;
- FilePath(const FilePath&) = default;
- FilePath(FilePath&&) = default;
-
- FilePath(string_type str) : _str(std::move(str)) {}
- FilePath(const value_type* str) : _str(str) {}
- FilePath(const boost::basic_string_view<value_type>& sv)
- : _str(sv.data(), sv.length())
- {}
-
- ~FilePath() = default;
-
- FilePath& operator=(const FilePath& path) = default;
- FilePath& operator=(FilePath&& path) noexcept;
- FilePath& operator=(string_type&& str);
-
- FilePath& operator/=(const FilePath& path);
-
- FilePath& operator+=(const FilePath& path);
- FilePath& operator+=(const string_type& str);
- FilePath& operator+=(const value_type* str);
- FilePath& operator+=(value_type chr);
- FilePath& operator+=(boost::basic_string_view<value_type> sv);
-
- void clear() noexcept { _str.clear(); }
-
- const string_type& native() const noexcept { return _str; }
- const string_type& string() const noexcept { return _str; }
- const value_type* c_str() const noexcept { return _str.c_str(); }
-
- operator string_type() const { return _str; }
-
- static FilePath root_name();
-
- FilePath root_directory() const;
- FilePath root_path() const;
- FilePath relative_path() const;
- FilePath parent_path() const;
- FilePath filename() const;
- FilePath stem() const;
- FilePath extension() const;
-
- bool empty() const noexcept { return _str.empty(); }
-
- bool is_absolute() const;
- bool is_relative() const { return !is_absolute(); }
-
-private:
- std::size_t find_first_sep() const;
- std::size_t find_last_sep() const;
-
- string_type _str;
-};
-
-INGEN_API bool operator==(const FilePath& lhs, const FilePath& rhs) noexcept;
-INGEN_API bool operator!=(const FilePath& lhs, const FilePath& rhs) noexcept;
-INGEN_API bool operator<(const FilePath& lhs, const FilePath& rhs) noexcept;
-INGEN_API bool operator<=(const FilePath& lhs, const FilePath& rhs) noexcept;
-INGEN_API bool operator>(const FilePath& lhs, const FilePath& rhs) noexcept;
-INGEN_API bool operator>=(const FilePath& lhs, const FilePath& rhs) noexcept;
-
-INGEN_API FilePath operator/(const FilePath& lhs, const FilePath& rhs);
-
-template <typename Char, typename Traits>
-std::basic_ostream<Char, Traits>&
-operator<<(std::basic_ostream<Char, Traits>& os, const FilePath& path)
-{
- return os << path.string();
-}
+using FilePath = std::filesystem::path;
} // namespace ingen
diff --git a/include/ingen/Node.hpp b/include/ingen/Node.hpp
index c8006a8e..3e07df2f 100644
--- a/include/ingen/Node.hpp
+++ b/include/ingen/Node.hpp
@@ -24,6 +24,7 @@
#include "lilv/lilv.h"
#include <cstdint>
+#include <filesystem>
#include <map>
#include <memory>
#include <string>
@@ -37,7 +38,6 @@ class Symbol;
namespace ingen {
class Arc;
-class FilePath;
class URIs;
/** A node in the audio graph.
@@ -75,7 +75,11 @@ public:
// Plugin blocks only
virtual LilvInstance* instance() { return nullptr; }
- virtual bool save_state(const FilePath& dir) const { return false; }
+
+ virtual bool save_state(const std::filesystem::path& dir) const
+ {
+ return false;
+ }
// All objects
virtual GraphType graph_type() const = 0;
diff --git a/include/ingen/URI.hpp b/include/ingen/URI.hpp
index 0c8d23ef..c344e7c2 100644
--- a/include/ingen/URI.hpp
+++ b/include/ingen/URI.hpp
@@ -22,20 +22,18 @@
#include "serd/serd.h"
#include "sord/sordmm.hpp"
-#include <boost/utility/string_view.hpp> // IWYU pragma: export
-#include <boost/utility/string_view_fwd.hpp> // IWYU pragma: export
-
#include <cstddef>
#include <cstdint>
#include <ostream>
#include <string>
+#include <string_view>
namespace ingen {
class INGEN_API URI
{
public:
- using Chunk = boost::string_view;
+ using Chunk = std::string_view;
URI();
explicit URI(const std::string& str);
diff --git a/include/ingen/filesystem.hpp b/include/ingen/filesystem.hpp
deleted file mode 100644
index 5a90e7b7..00000000
--- a/include/ingen/filesystem.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2007-2017 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef INGEN_FILESYSTEM_HPP
-#define INGEN_FILESYSTEM_HPP
-
-#include "ingen/FilePath.hpp"
-
-#ifdef _WIN32
-# include <windows.h>
-# include <io.h>
-# define F_OK 0
-# define mkdir(path, flags) _mkdir(path)
-#else
-# include <unistd.h>
-#endif
-
-#include <sys/stat.h>
-
-#include <algorithm>
-#include <cerrno>
-#include <cstdlib>
-#include <memory>
-#include <vector>
-
-/* A minimal subset of the std::filesystem API from C++17. */
-
-namespace ingen {
-namespace filesystem {
-
-inline bool exists(const FilePath& path)
-{
- return !access(path.c_str(), F_OK);
-}
-
-inline bool is_directory(const FilePath& path)
-{
- struct stat info{};
- stat(path.c_str(), &info);
- return S_ISDIR(info.st_mode);
-}
-
-inline bool create_directories(const FilePath& path)
-{
- std::vector<FilePath> paths;
- for (FilePath p = path; p != path.root_directory(); p = p.parent_path()) {
- paths.emplace_back(p);
- }
-
- for (auto p = paths.rbegin(); p != paths.rend(); ++p) {
- if (mkdir(p->c_str(), 0755) && errno != EEXIST) {
- return false;
- }
- }
-
- return true;
-}
-
-inline FilePath current_path()
-{
- struct Freer { void operator()(char* const ptr) { free(ptr); } };
-
- std::unique_ptr<char, Freer> cpath(realpath(".", nullptr));
-
- return {cpath.get()};
-}
-
-} // namespace filesystem
-} // namespace ingen
-
-#endif // INGEN_FILESYSTEM_HPP
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 5af9fea1..705594c9 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -17,7 +17,6 @@
#include "ingen/Configuration.hpp"
#include "ingen/Forge.hpp"
#include "ingen/URIMap.hpp"
-#include "ingen/filesystem.hpp"
#include "ingen/fmt.hpp"
#include "ingen/ingen.h"
#include "ingen/runtime_paths.hpp"
@@ -33,7 +32,9 @@
#include <cstdint>
#include <cstdlib>
#include <cstring>
+#include <filesystem>
#include <memory>
+#include <sstream>
#include <thread>
#include <utility>
#include <vector>
@@ -232,7 +233,7 @@ Configuration::parse(int argc, char** argv)
bool
Configuration::load(const FilePath& path)
{
- if (!filesystem::exists(path)) {
+ if (!std::filesystem::exists(path)) {
return false;
}
@@ -280,7 +281,7 @@ Configuration::save(URIMap& uri_map,
// Create parent directories if necessary
const FilePath dir = path.parent_path();
- if (!filesystem::create_directories(dir)) {
+ if (!std::filesystem::create_directories(dir)) {
throw FileError(fmt("Error creating directory %1% (%2%)",
dir, strerror(errno)));
}
diff --git a/src/FilePath.cpp b/src/FilePath.cpp
deleted file mode 100644
index 8cbd3a9e..00000000
--- a/src/FilePath.cpp
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2018 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "ingen/FilePath.hpp"
-
-#include <algorithm>
-#include <string>
-#include <utility>
-
-namespace ingen {
-
-template <typename Char>
-static bool
-is_sep(const Char chr)
-{
-#if USE_WINDOWS_FILE_PATHS
- return chr == L'/' || chr == preferred_separator;
-#else
- return chr == '/';
-#endif
-}
-
-FilePath&
-FilePath::operator=(FilePath&& path) noexcept
-{
- _str = std::move(path._str);
- path.clear();
- return *this;
-}
-
-FilePath&
-FilePath::operator=(string_type&& str)
-{
- _str = std::move(str);
- return *this;
-}
-
-FilePath&
-FilePath::operator/=(const FilePath& path)
-{
- const FilePath::string_type& str = path.string();
- if (!_str.empty() && !is_sep(_str.back()) && !str.empty() &&
- !is_sep(str.front())) {
- _str += preferred_separator;
- }
-
- _str += str;
- return *this;
-}
-
-FilePath&
-FilePath::operator+=(const FilePath& path)
-{
- return operator+=(path.native());
-}
-
-FilePath&
-FilePath::operator+=(const string_type& str)
-{
- _str += str;
- return *this;
-}
-
-FilePath&
-FilePath::operator+=(const value_type* str)
-{
- _str += str;
- return *this;
-}
-
-FilePath&
-FilePath::operator+=(value_type chr)
-{
- _str += chr;
- return *this;
-}
-
-FilePath&
-FilePath::operator+=(boost::basic_string_view<value_type> sv)
-{
- _str.append(sv.data(), sv.size());
- return *this;
-}
-
-FilePath
-FilePath::root_name()
-{
-#if USE_WINDOWS_FILE_PATHS
- if (_str.length() >= 2 && _str[0] >= 'A' && _str[0] <= 'Z' &&
- _str[1] == ':') {
- return FilePath(_str.substr(0, 2));
- }
-#endif
-
- return {};
-}
-
-FilePath
-FilePath::root_directory() const
-{
-#if USE_WINDOWS_FILE_PATHS
- const auto name = root_name().string();
- return name.empty() ? Path() : Path(name + preferred_separator);
-#endif
-
- return _str[0] == '/' ? FilePath("/") : FilePath();
-}
-
-FilePath
-FilePath::root_path() const
-{
-#if USE_WINDOWS_FILE_PATHS
- const auto name = root_name();
- return name.empty() ? FilePath() : name / root_directory();
-#endif
- return root_directory();
-}
-
-FilePath
-FilePath::relative_path() const
-{
- const auto root = root_path();
- return root.empty() ? FilePath()
- : FilePath(_str.substr(root.string().length()));
-}
-
-FilePath
-FilePath::parent_path() const
-{
- if (empty() || *this == root_path()) {
- return *this;
- }
-
- const auto first_sep = find_first_sep();
- const auto last_sep = find_last_sep();
- return ((last_sep == std::string::npos || last_sep == first_sep)
- ? root_path()
- : FilePath(_str.substr(0, last_sep)));
-}
-
-FilePath
-FilePath::filename() const
-{
- return ((empty() || *this == root_path())
- ? FilePath()
- : FilePath(_str.substr(find_last_sep() + 1)));
-}
-
-FilePath
-FilePath::stem() const
-{
- const auto name = filename();
- const auto dot = name.string().find('.');
- return ((dot == std::string::npos) ? name
- : FilePath(name.string().substr(0, dot)));
-}
-
-FilePath
-FilePath::extension() const
-{
- const auto name = filename().string();
- const auto dot = name.find('.');
- return ((dot == std::string::npos) ? FilePath()
- : FilePath(name.substr(dot, dot)));
-}
-
-bool
-FilePath::is_absolute() const
-{
-#if USE_WINDOWS_FILE_PATHS
- return !root_name().empty();
-#else
- return !root_directory().empty();
-#endif
-}
-
-std::size_t
-FilePath::find_first_sep() const
-{
- const auto i = std::find_if(_str.begin(), _str.end(), is_sep<value_type>);
- return i == _str.end() ? std::string::npos : (i - _str.begin());
-}
-
-std::size_t
-FilePath::find_last_sep() const
-{
- const auto i = std::find_if(_str.rbegin(), _str.rend(), is_sep<value_type>);
- return (i == _str.rend() ? std::string::npos
- : (_str.length() - 1 - (i - _str.rbegin())));
-}
-
-bool
-operator==(const FilePath& lhs, const FilePath& rhs) noexcept
-{
- return lhs.string() == rhs.string();
-}
-
-bool
-operator!=(const FilePath& lhs, const FilePath& rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-bool
-operator<(const FilePath& lhs, const FilePath& rhs) noexcept
-{
- return lhs.string().compare(rhs.string()) < 0;
-}
-
-bool
-operator<=(const FilePath& lhs, const FilePath& rhs) noexcept
-{
- return !(rhs < lhs);
-}
-
-bool
-operator>(const FilePath& lhs, const FilePath& rhs) noexcept
-{
- return rhs < lhs;
-}
-
-bool
-operator>=(const FilePath& lhs, const FilePath& rhs) noexcept
-{
- return !(lhs < rhs);
-}
-
-FilePath
-operator/(const FilePath& lhs, const FilePath& rhs)
-{
- return FilePath(lhs) /= rhs;
-}
-
-} // namespace ingen
diff --git a/src/Parser.cpp b/src/Parser.cpp
index 7b25031c..a27dc2b3 100644
--- a/src/Parser.cpp
+++ b/src/Parser.cpp
@@ -27,7 +27,6 @@
#include "ingen/URIMap.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
-#include "ingen/filesystem.hpp"
#include "ingen/paths.hpp"
#include "lv2/atom/atom.h"
#include "lv2/core/lv2.h"
@@ -40,9 +39,12 @@
#include <cassert>
#include <cstdint>
#include <cstring>
+#include <filesystem>
#include <map>
#include <set>
+#include <sstream>
#include <string>
+#include <string_view>
#include <utility>
#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@@ -591,11 +593,11 @@ Parser::parse_file(ingen::World& world,
// Get absolute file path
FilePath file_path = path;
if (!file_path.is_absolute()) {
- file_path = filesystem::current_path() / file_path;
+ file_path = std::filesystem::current_path() / file_path;
}
// Find file to use as manifest
- const bool is_bundle = filesystem::is_directory(file_path);
+ const bool is_bundle = std::filesystem::is_directory(file_path);
const FilePath manifest_path =
(is_bundle ? file_path / "manifest.ttl" : file_path);
diff --git a/src/Serialiser.cpp b/src/Serialiser.cpp
index 21d8286f..7bfa4211 100644
--- a/src/Serialiser.cpp
+++ b/src/Serialiser.cpp
@@ -28,7 +28,6 @@
#include "ingen/URIMap.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
-#include "ingen/filesystem.hpp"
#include "ingen/runtime_paths.hpp"
#include "lv2/core/lv2.h"
#include "lv2/state/state.h"
@@ -44,11 +43,14 @@
#include <cassert>
#include <cstdint>
#include <cstring>
+#include <filesystem>
#include <map>
#include <memory>
#include <set>
+#include <sstream>
#include <stdexcept>
#include <string>
+#include <string_view>
#include <utility>
namespace ingen {
@@ -190,12 +192,12 @@ Serialiser::Impl::write_bundle(const std::shared_ptr<const Node>& graph,
const URI& uri)
{
FilePath path(uri.path());
- if (filesystem::exists(path) && !filesystem::is_directory(path)) {
+ if (std::filesystem::exists(path) && !std::filesystem::is_directory(path)) {
path = path.parent_path();
}
_world.log().info("Writing bundle %1%\n", path);
- filesystem::create_directories(path);
+ std::filesystem::create_directories(path);
const FilePath main_file = path / "main.ttl";
const raul::Path old_root_path = _root_path;
@@ -454,7 +456,7 @@ Serialiser::Impl::serialise_block(const std::shared_ptr<const Node>& block,
if (_base_uri.scheme() == "file") {
const FilePath base_path = _base_uri.file_path();
const FilePath graph_dir = base_path.parent_path();
- const FilePath state_dir = graph_dir / block->symbol();
+ const FilePath state_dir = graph_dir / std::string(block->symbol());
const FilePath state_file = state_dir / "state.ttl";
if (block->save_state(state_dir)) {
_model->add_statement(block_id,
diff --git a/src/World.cpp b/src/World.cpp
index e2db1a57..c03641f5 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -20,7 +20,6 @@
#include "ingen/Configuration.hpp"
#include "ingen/DataAccess.hpp"
#include "ingen/EngineBase.hpp"
-#include "ingen/FilePath.hpp"
#include "ingen/Forge.hpp"
#include "ingen/InstanceAccess.hpp"
#include "ingen/LV2Features.hpp"
@@ -40,9 +39,11 @@
#include "sord/sordmm.hpp"
#include <cstdint>
+#include <filesystem>
#include <list>
#include <map>
#include <memory>
+#include <sstream>
#include <string>
#include <utility>
diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp
index 7c5fdd99..d3672bda 100644
--- a/src/gui/ThreadedLoader.cpp
+++ b/src/gui/ThreadedLoader.cpp
@@ -20,13 +20,11 @@
#include "ingen/Log.hpp"
#include "ingen/Parser.hpp"
-#include "ingen/Properties.hpp"
#include "ingen/Serialiser.hpp"
#include "ingen/URI.hpp"
#include "ingen/World.hpp"
#include "ingen/client/GraphModel.hpp"
#include "raul/Path.hpp"
-#include "raul/Symbol.hpp"
#include <boost/optional/optional.hpp>
#include <glibmm/ustring.h>
@@ -35,8 +33,10 @@
#include <sigc++/functors/mem_fun.h>
#include <cassert>
+#include <filesystem>
#include <memory>
#include <string>
+#include <string_view>
#include <utility>
using boost::optional;
diff --git a/src/meson.build b/src/meson.build
index 6c83ae95..833a9db2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,7 +7,6 @@ sources = files(
'ClashAvoider.cpp',
'ColorContext.cpp',
'Configuration.cpp',
- 'FilePath.cpp',
'Forge.cpp',
'LV2Features.cpp',
'Library.cpp',
diff --git a/src/runtime_paths.cpp b/src/runtime_paths.cpp
index 86315be8..b876ebd4 100644
--- a/src/runtime_paths.cpp
+++ b/src/runtime_paths.cpp
@@ -17,12 +17,11 @@
#include "ingen/runtime_paths.hpp"
#include "ingen/FilePath.hpp"
-#include "ingen/filesystem.hpp"
#include "ingen_config.h"
-#include <algorithm>
#include <cstdlib>
#include <dlfcn.h>
+#include <filesystem>
#include <sstream>
#include <string>
@@ -92,7 +91,7 @@ find_in_search_path(const std::string& name,
{
for (const auto& dir : search_path) {
FilePath path = dir / name;
- if (filesystem::exists(path)) {
+ if (std::filesystem::exists(path)) {
return path;
}
}
diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp
index 9e907ffa..fa3979cd 100644
--- a/src/server/LV2Block.hpp
+++ b/src/server/LV2Block.hpp
@@ -38,6 +38,7 @@
#include <cstdint>
#include <cstdlib>
#include <cstring>
+#include <filesystem>
#include <memory>
#include <mutex>
@@ -59,7 +60,6 @@ struct constant_time_size;
namespace ingen {
-class FilePath;
class Resource;
class URIs;
class World;
@@ -91,7 +91,7 @@ public:
bool instantiate(BufferFactory& bufs, const LilvState* state);
LilvInstance* instance() override { return instance(0); }
- bool save_state(const FilePath& dir) const override;
+ bool save_state(const std::filesystem::path& dir) const override;
BlockImpl* duplicate(Engine& engine,
const raul::Symbol& symbol,
@@ -121,7 +121,7 @@ public:
const BufferRef& buf,
SampleCount offset) override;
- static StatePtr load_state(World& world, const FilePath& path);
+ static StatePtr load_state(World& world, const std::filesystem::path& path);
protected:
struct Instance : public raul::Noncopyable {
diff --git a/src/server/events/Copy.cpp b/src/server/events/Copy.cpp
index beb5224c..06a71fdc 100644
--- a/src/server/events/Copy.cpp
+++ b/src/server/events/Copy.cpp
@@ -40,6 +40,7 @@
#include <memory>
#include <mutex>
#include <string>
+#include <string_view>
#include <utility>
namespace ingen {
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index aba49adb..ec1af085 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -48,6 +48,7 @@
#include <memory>
#include <mutex>
#include <string>
+#include <string_view>
namespace ingen {
namespace server {
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 71d4b48f..af3d5b59 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -53,6 +53,7 @@
#include <mutex>
#include <set>
#include <string>
+#include <string_view>
#include <utility>
#include <vector>
diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp
index d6ebee26..9dfc3641 100644
--- a/tests/ingen_test.cpp
+++ b/tests/ingen_test.cpp
@@ -29,7 +29,6 @@
#include "ingen/URI.hpp"
#include "ingen/URIMap.hpp"
#include "ingen/World.hpp"
-#include "ingen/filesystem.hpp"
#include "ingen/fmt.hpp"
#include "ingen/memory.hpp"
#include "ingen/runtime_paths.hpp"
@@ -42,9 +41,11 @@
#include <cstdint>
#include <cstdlib>
#include <exception>
+#include <filesystem>
#include <iostream>
#include <map>
#include <memory>
+#include <sstream>
#include <string>
#include <utility>
@@ -202,7 +203,7 @@ run(int argc, char** argv)
auto r = world->store()->find(raul::Path("/"));
const std::string base = run_path.stem();
const std::string out_name = base.substr(0, base.find('.')) + ".out.ingen";
- const FilePath out_path = filesystem::current_path() / out_name;
+ const FilePath out_path = std::filesystem::current_path() / out_name;
world->serialiser()->write_bundle(r->second, URI(out_path));
// Undo every event (makes the graph identical to the original)
@@ -214,7 +215,7 @@ run(int argc, char** argv)
// Save completely undone graph
r = world->store()->find(raul::Path("/"));
const std::string undo_name = base.substr(0, base.find('.')) + ".undo.ingen";
- const FilePath undo_path = filesystem::current_path() / undo_name;
+ const FilePath undo_path = std::filesystem::current_path() / undo_name;
world->serialiser()->write_bundle(r->second, URI(undo_path));
// Redo every event (makes the graph identical to the pre-undo output)
@@ -226,7 +227,7 @@ run(int argc, char** argv)
// Save completely redone graph
r = world->store()->find(raul::Path("/"));
const std::string redo_name = base.substr(0, base.find('.')) + ".redo.ingen";
- const FilePath redo_path = filesystem::current_path() / redo_name;
+ const FilePath redo_path = std::filesystem::current_path() / redo_name;
world->serialiser()->write_bundle(r->second, URI(redo_path));
serd_env_free(env);
diff --git a/tests/meson.build b/tests/meson.build
index a9bf5725..50b78624 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -6,7 +6,6 @@
##############
unit_tests = [
- 'FilePath',
]
foreach test : unit_tests
diff --git a/tests/tst_FilePath.cpp b/tests/tst_FilePath.cpp
deleted file mode 100644
index 75744f46..00000000
--- a/tests/tst_FilePath.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- This file is part of Ingen.
- Copyright 2018 David Robillard <http://drobilla.net/>
-
- Ingen is free software: you can redistribute it and/or modify it under the
- terms of the GNU Affero General Public License as published by the Free
- Software Foundation, either version 3 of the License, or any later version.
-
- Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU Affero General Public License for details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Ingen. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "test_utils.hpp"
-
-#include "ingen/FilePath.hpp"
-#include "ingen/fmt.hpp"
-
-#include <boost/utility/string_view_fwd.hpp>
-
-#include <string>
-
-using ingen::FilePath;
-using ingen::fmt;
-
-int
-main(int, char**)
-{
- EXPECT_EQ(FilePath("/").parent_path(), FilePath("/"));
-
- EXPECT_TRUE(FilePath("/abs").is_absolute());
- EXPECT_FALSE(FilePath("/abs").is_relative());
- EXPECT_EQ(FilePath("/abs").root_name(), FilePath());
- EXPECT_EQ(FilePath("/abs").root_directory(), FilePath("/"));
- EXPECT_EQ(FilePath("/abs").root_path(), FilePath("/"));
- EXPECT_EQ(FilePath("/abs").relative_path(), FilePath("abs"));
- EXPECT_EQ(FilePath("/abs").parent_path(), FilePath("/"));
- EXPECT_EQ(FilePath("/abs").filename(), FilePath("abs"));
- EXPECT_EQ(FilePath("/abs").stem(), FilePath("abs"));
- EXPECT_EQ(FilePath("/abs").extension(), FilePath());
-
- EXPECT_FALSE(FilePath("rel").is_absolute());
- EXPECT_TRUE(FilePath("rel").is_relative());
- EXPECT_EQ(FilePath("rel").root_name(), FilePath());
- EXPECT_EQ(FilePath("rel").root_directory(), FilePath());
- EXPECT_EQ(FilePath("rel").root_path(), FilePath());
- EXPECT_EQ(FilePath("rel").relative_path(), FilePath());
- EXPECT_EQ(FilePath("rel").parent_path(), FilePath());
- EXPECT_EQ(FilePath("rel").filename(), "rel");
- EXPECT_EQ(FilePath("rel").stem(), "rel");
- EXPECT_EQ(FilePath("rel").extension(), FilePath());
-
- EXPECT_FALSE(FilePath("file.txt").is_absolute());
- EXPECT_TRUE(FilePath("file.txt").is_relative());
- EXPECT_EQ(FilePath("file.txt").filename(), "file.txt");
- EXPECT_EQ(FilePath("file.txt").stem(), "file");
- EXPECT_EQ(FilePath("file.txt").extension(), ".txt");
-
- EXPECT_TRUE(FilePath("/abs/file.txt").is_absolute());
- EXPECT_FALSE(FilePath("/abs/file.txt").is_relative());
- EXPECT_EQ(FilePath("/abs/file.txt").filename(), "file.txt");
- EXPECT_EQ(FilePath("/abs/file.txt").stem(), "file");
- EXPECT_EQ(FilePath("/abs/file.txt").extension(), ".txt");
-
- EXPECT_FALSE(FilePath("rel/file.txt").is_absolute());
- EXPECT_TRUE(FilePath("rel/file.txt").is_relative());
- EXPECT_EQ(FilePath("rel/file.txt").filename(), "file.txt");
- EXPECT_EQ(FilePath("rel/file.txt").stem(), "file");
- EXPECT_EQ(FilePath("rel/file.txt").extension(), ".txt");
-
- FilePath path("/x");
- EXPECT_EQ(path, "/x");
- path = std::string("/a");
- EXPECT_EQ(path, "/a");
-
- path /= FilePath("b");
- EXPECT_EQ(path, "/a/b");
-
- path += FilePath("ar");
- EXPECT_EQ(path, "/a/bar");
-
- path += std::string("/c");
- EXPECT_EQ(path, "/a/bar/c");
-
- path += "a";
- EXPECT_EQ(path, "/a/bar/ca");
-
- path += 'r';
- EXPECT_EQ(path, "/a/bar/car");
-
- path += boost::string_view("/d");
- EXPECT_EQ(path, "/a/bar/car/d");
-
- const FilePath apple("apple");
- const FilePath zebra("zebra");
- EXPECT_TRUE(apple == apple);
- EXPECT_TRUE(apple != zebra);
- EXPECT_TRUE(apple < zebra);
- EXPECT_TRUE(apple <= zebra);
- EXPECT_TRUE(apple <= apple);
- EXPECT_TRUE(zebra > apple);
- EXPECT_TRUE(zebra >= apple);
- EXPECT_TRUE(zebra >= zebra);
- return 0;
-}