You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Optimize calls of utf8 in a few spots to avoid calling it more than once.
This commit is contained in:
@@ -311,18 +311,16 @@ bool FileAccessUnix::store_buffer(const uint8_t *p_src, uint64_t p_length) {
|
||||
}
|
||||
|
||||
bool FileAccessUnix::file_exists(const String &p_path) {
|
||||
int err;
|
||||
struct stat st = {};
|
||||
String filename = fix_path(p_path);
|
||||
const CharString filename_utf8 = fix_path(p_path).utf8();
|
||||
|
||||
// Does the name exist at all?
|
||||
err = stat(filename.utf8().get_data(), &st);
|
||||
if (err) {
|
||||
if (stat(filename_utf8.get_data(), &st)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// See if we have access to the file
|
||||
if (access(filename.utf8().get_data(), F_OK)) {
|
||||
if (access(filename_utf8.get_data(), F_OK)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user