add cut
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user