diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-09 10:34:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-09 10:34:21 +0200 |
commit | 1f192c43b00216482d6eba7e04c2d081c83acf4e (patch) | |
tree | 628490013a0d2cd7b349ab15ad0d62365e1e5d53 /platform/linuxbsd | |
parent | 6f72d9d19fe11ccc38a69e0460813646ad28d0e5 (diff) | |
parent | a3384b7461005260d0dd5c8f05df28ee842442de (diff) |
Merge pull request #51429 from omar-polo/fix-basename
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 2c9801f512..69474c6dec 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -463,7 +463,10 @@ Error OS_LinuxBSD::move_to_trash(const String &p_path) { // The trash can is successfully created, now we check that we don't exceed our file name length limit. // If the file name is too long trim it so we can add the identifying number and ".trashinfo". // Assumes that the file name length limit is 255 characters. - String file_name = basename(p_path.utf8().get_data()); + String file_name = p_path.get_file(); + if (file_name.length() == 0) { + file_name = p_path.get_base_dir().get_file(); + } if (file_name.length() > 240) { file_name = file_name.substr(0, file_name.length() - 15); } |