This commit is contained in:
chatlanin
2023-04-15 12:57:46 +03:00
parent d2816fb157
commit 73a3b29196
5 changed files with 90 additions and 17 deletions

View File

@@ -258,4 +258,36 @@ namespace rrr
nav.fill(PWD);
increment_position(-1);
}
void content::cut(std::filesystem::path f)
{
std::filesystem::path target;
if (std::filesystem::exists(PWD / f.filename()))
{
target = f.filename().string() + "_" +
std::to_string(
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count()
);
target = f.parent_path() / std::filesystem::path(target);
}
else
{
target = PWD / f.filename();
}
std::string cmd = "mv ";
hack::utils::unix_cmd(cmd + f.string() + " " + target.string());
nav.fill(PWD);
tbb::parallel_for(tbb::blocked_range<int>(0, nav.data.size()), [&](tbb::blocked_range<int> r)
{
for (int i = r.begin(); i < r.end(); ++i)
if (nav.data.at(i).path == target)
{
navigation_cursor_position = i;
}
});
check_cursor_position();
}
}