#include <manifest_parser/utils/logging.h>
-#include <boost/filesystem.hpp>
-
#include <gio/gio.h>
#include <glib.h>
#include <cstdlib>
#include <functional>
+#include <filesystem>
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
namespace {
class TzipInterface::Pimpl {
public:
- explicit Pimpl(const boost::filesystem::path& mount_path) :
+ explicit Pimpl(const std::filesystem::path& mount_path) :
mount_path_(mount_path), dbus_proxy_(new DBusProxy()) { }
- bool MountZip(const boost::filesystem::path& zip_path) {
+ bool MountZip(const std::filesystem::path& zip_path) {
zip_path_ = zip_path;
if (IsMounted()) {
UnmountZip();
}
- if (bf::exists(mount_path_)) {
+ if (fs::exists(mount_path_)) {
LOG(WARNING) << "Mount path(" << mount_path_ << ") already exists! "
<< "We will remove it...";
- bf::remove(mount_path_);
+ fs::remove(mount_path_);
}
- if (!bf::exists(zip_path)) {
+ if (!fs::exists(zip_path)) {
LOG(WARNING) << "zip path(" << zip_path << ") doesn't exist!";
return false;
}
- const char* mount_path_str = mount_path_.string().c_str();
- const char* zip_path_str = zip_path_.string().c_str();
+ const char* mount_path_str = mount_path_.c_str();
+ const char* zip_path_str = zip_path_.c_str();
const char* tzip_smack_rule = kTzipSmackRule;
GVariant* r = dbus_proxy_->ProxyCallSync(kTzipMountMethod,
}
bool UnmountZip() {
- const char* mount_path_str = mount_path_.string().c_str();
+ const char* mount_path_str = mount_path_.c_str();
GVariant* r = dbus_proxy_->ProxyCallSync(kTzipUnmountMethod,
g_variant_new("(s)", mount_path_str));
private:
bool IsMounted() {
- const char* mount_path_str = mount_path_.string().c_str();
+ const char* mount_path_str = mount_path_.c_str();
GVariant* r = dbus_proxy_->ProxyCallSync(kTzipIsMountedMethod,
g_variant_new("(s)", mount_path_str));
if (!r)
return true;
}
- boost::filesystem::path mount_path_;
- boost::filesystem::path zip_path_;
+ std::filesystem::path mount_path_;
+ std::filesystem::path zip_path_;
std::unique_ptr<DBusProxy> dbus_proxy_;
};
-TzipInterface::TzipInterface(const boost::filesystem::path& mount_path)
+TzipInterface::TzipInterface(const std::filesystem::path& mount_path)
: impl_(new Pimpl(mount_path)) {}
TzipInterface::~TzipInterface() { }
-bool TzipInterface::MountZip(const boost::filesystem::path& zip_path) {
+bool TzipInterface::MountZip(const std::filesystem::path& zip_path) {
return impl_->MountZip(zip_path);
}