2024-01-24 21:49:02 -06:00
|
|
|
#include "branch2.hpp"
|
2024-01-25 22:39:56 -06:00
|
|
|
|
2024-01-31 21:17:45 -06:00
|
|
|
#include <iostream>
|
|
|
|
|
|
2024-01-31 21:38:11 -06:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
2024-01-25 22:39:56 -06:00
|
|
|
|
2024-01-29 00:00:38 -06:00
|
|
|
Branch2::Branch2()
|
|
|
|
|
: mode(Mode::RW)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-25 22:39:56 -06:00
|
|
|
Branch2::Branch2(toml::value const &v_)
|
2024-01-29 00:02:15 -06:00
|
|
|
: mode(Mode::RW)
|
2024-01-25 22:39:56 -06:00
|
|
|
{
|
2024-01-31 21:17:45 -06:00
|
|
|
std::cout << v_ << '\n';
|
2024-01-31 21:19:29 -06:00
|
|
|
|
2024-01-29 00:07:09 -06:00
|
|
|
enabled = v_.at("enabled").as_boolean();
|
2024-01-31 21:20:34 -06:00
|
|
|
mode = Mode::_from_string(toml::find<std::string>(v_,"mode").c_str());
|
2024-01-29 00:07:09 -06:00
|
|
|
min_free_space = 0;
|
2024-01-29 00:07:45 -06:00
|
|
|
path = toml::find<std::string>(v_,"path");
|
2024-01-31 21:38:11 -06:00
|
|
|
|
2024-01-31 21:38:38 -06:00
|
|
|
int const flags = O_DIRECTORY | O_PATH | O_NOATIME;
|
2024-01-31 21:38:19 -06:00
|
|
|
fd = openat(AT_FDCWD,path.string().c_str(),flags);
|
2024-01-25 22:39:56 -06:00
|
|
|
}
|