Hi i am using QProces but everyone know that the path never is recorded. And like i'm learning about vector's i am trying to do one example with this.
I was thinking to use this:
First i put the path so with this new_path.cd(path); i change the path and with the follow code i return back with
auto const path = paths.back();
paths.pop_back();
Or i change the path with cd Path so what do you think good idea?
Code:
//store the paths you iterate
std::vector<QString> paths;
paths.emplace_back("first path");
paths.emplace_back("second path");
if(input_path == "cd"){
QDir new_path
(paths.
back());
new_path.cd();
paths.emplace_back(new_path.absolutePath());
}
//back to previous path, stl split back and pop_back to two actions for the sake of exception safe
auto const path = paths.back();
paths.pop_back();
//store the paths you iterate
std::vector<QString> paths;
paths.emplace_back("first path");
paths.emplace_back("second path");
if(input_path == "cd"){
QDir new_path(paths.back());
new_path.cd();
paths.emplace_back(new_path.absolutePath());
}
//back to previous path, stl split back and pop_back to two actions for the sake of exception safe
auto const path = paths.back();
paths.pop_back();
To copy to clipboard, switch view to plain text mode
It's for learning more about vector's
Bookmarks