Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't find basename() on OpenBSD #48938

Closed
omar-polo opened this issue May 21, 2021 · 0 comments · Fixed by #51429
Closed

can't find basename() on OpenBSD #48938

omar-polo opened this issue May 21, 2021 · 0 comments · Fixed by #51429

Comments

@omar-polo
Copy link
Contributor

Godot version: built from master e773bf5

OS/device including version: OpenBSD-CURRENT

Issue description:

The compilation fails because it doesn't find basename:

platform/linuxbsd/os_linuxbsd.cpp:402:21: error: use of undeclared identifier 'basename'
        String file_name = basename(p_path.utf8().get_data());

#include <libgen.h> (to bring in basename(3)) doesn't seem to fix it, since then it complains about char* vs string. I ended up with the following, which at least compiles and seems to work, but I don't know how much sense it makes.

--- os_linuxbsd.cpp.orig        Fri May 21 15:24:54 2021
+++ os_linuxbsd.cpp     Fri May 21 20:58:52 2021
@@ -397,7 +399,7 @@
        // 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_basename();
        if (file_name.length() > 240) {
                file_name = file_name.substr(0, file_name.length() - 15);
        }

Steps to reproduce:

godot doesn't compile as-is from the master branch, it needs some patches (in particular for some third parties stuff), but none of those should cause this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants