FileManager: Created desktop shortcuts should use full basename

A shortcut to ReadMe.md should be called "ReadMe.md", not "ReadMe".
This commit is contained in:
Andreas Kling 2020-12-28 09:38:11 +01:00
parent 327f595f63
commit 26cb083c6e
Notes: sideshowbarker 2024-07-19 00:30:40 +09:00

View file

@ -175,8 +175,7 @@ void do_paste(const String& target_directory, GUI::Window* window)
void do_create_link(const Vector<String>& selected_file_paths, GUI::Window* window)
{
auto path = selected_file_paths.first();
auto title = LexicalPath(path.view()).title();
auto destination = String::formatted("{}/{}", Core::StandardPaths::desktop_directory(), title);
auto destination = String::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath { path }.basename());
if (!FileUtils::link_file(path, destination)) {
GUI::MessageBox::show(window, "Could not create desktop shortcut", "File Manager",
GUI::MessageBox::Type::Error);