summaryrefslogtreecommitdiff
path: root/util.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-11-04 01:39:56 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-11-04 01:39:56 -0400
commit1f445742b4fbc185fe0e24d9ed2478e4f7495f53 (patch)
tree115717c39b7769a7ad97776fbc299362fd8b10c9 /util.cpp
parentd629846220d069a86b000db213d47c8681e8f57a (diff)
downloadabaddon-portaudio-1f445742b4fbc185fe0e24d9ed2478e4f7495f53.tar.gz
abaddon-portaudio-1f445742b4fbc185fe0e24d9ed2478e4f7495f53.zip
preserve channel list expansion and active channel (#36)
also check getenv in platform
Diffstat (limited to 'util.cpp')
-rw-r--r--util.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/util.cpp b/util.cpp
index 7b686ca..34ca6d4 100644
--- a/util.cpp
+++ b/util.cpp
@@ -1,4 +1,5 @@
#include "util.hpp"
+#include <filesystem>
Semaphore::Semaphore(int count)
: m_count(count) {}
@@ -200,3 +201,17 @@ void AddPointerCursor(Gtk::Widget &widget) {
window->set_cursor(cursor);
});
}
+
+bool util::IsFolder(std::string_view path) {
+ std::error_code ec;
+ const auto status = std::filesystem::status(path, ec);
+ if (ec) return false;
+ return status.type() == std::filesystem::file_type::directory;
+}
+
+bool util::IsFile(std::string_view path) {
+ std::error_code ec;
+ const auto status = std::filesystem::status(path, ec);
+ if (ec) return false;
+ return status.type() == std::filesystem::file_type::regular;
+}