convert relative to absolute
This commit is contained in:
parent
65bbde5c0e
commit
85b7ba00f6
@ -54,8 +54,11 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
directory_path = argv[1];
|
||||
current_path = directory_path;
|
||||
//directory_path = argv[1];
|
||||
// Convert relative input (like "../../..") into a full absolute path
|
||||
std::filesystem::path directory_path = std::filesystem::absolute(argv[1]).lexically_normal();
|
||||
current_path = directory_path.string();
|
||||
//current_path = directory_path;
|
||||
}
|
||||
|
||||
// Check if the directory exists
|
||||
@ -105,6 +108,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
std::string selected_name;
|
||||
std::filesystem::path new_path;
|
||||
|
||||
if (clean_names.size() > 0)
|
||||
selected_name = clean_names[selected];
|
||||
// Construct the new path
|
||||
@ -114,6 +118,8 @@ int main(int argc, char* argv[]) {
|
||||
else {
|
||||
new_path = std::filesystem::path(current_path) / selected_name;
|
||||
}
|
||||
|
||||
new_path = std::filesystem::absolute(new_path).lexically_normal();
|
||||
new_path.make_preferred();
|
||||
current_path = new_path.string();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user