You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-25 15:37:42 +00:00
Merge pull request #106797 from syntaxerror247/nomedia-crash
Android Editor: Disable `nomedia` file creation for Android 11 (api level 30)
This commit is contained in:
@@ -1069,6 +1069,9 @@ void EditorFileSystem::scan() {
|
||||
if (first_scan) {
|
||||
_first_scan_filesystem();
|
||||
#ifdef ANDROID_ENABLED
|
||||
// Android 11 has some issues with nomedia files, so it's disabled there. See GH-106479 and GH-105399 for details.
|
||||
String sdk_version = OS::get_singleton()->get_version().get_slicec('.', 0);
|
||||
if (sdk_version != "30") {
|
||||
const String nomedia_file_path = ProjectSettings::get_singleton()->get_resource_path().path_join(".nomedia");
|
||||
if (!FileAccess::exists(nomedia_file_path)) {
|
||||
// Create a .nomedia file to hide assets from media apps on Android.
|
||||
@@ -1080,6 +1083,7 @@ void EditorFileSystem::scan() {
|
||||
f->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -739,6 +739,9 @@ void ProjectDialog::ok_pressed() {
|
||||
hide();
|
||||
if (mode == MODE_NEW || mode == MODE_IMPORT || mode == MODE_INSTALL) {
|
||||
#ifdef ANDROID_ENABLED
|
||||
// Android 11 has some issues with nomedia files, so it's disabled there. See GH-106479, GH-105399 for details.
|
||||
String sdk_version = OS::get_singleton()->get_version().get_slicec('.', 0);
|
||||
if (sdk_version != "30") {
|
||||
// Create a .nomedia file to hide assets from media apps on Android.
|
||||
const String nomedia_file_path = path.path_join(".nomedia");
|
||||
Ref<FileAccess> f2 = FileAccess::open(nomedia_file_path, FileAccess::WRITE);
|
||||
@@ -748,6 +751,7 @@ void ProjectDialog::ok_pressed() {
|
||||
} else {
|
||||
f2->close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
emit_signal(SNAME("project_created"), path, edit_check_box->is_pressed());
|
||||
} else if (mode == MODE_DUPLICATE) {
|
||||
|
||||
@@ -315,7 +315,7 @@ String OS_Android::get_version() const {
|
||||
}
|
||||
|
||||
// Handles stock Android.
|
||||
String sdk_version = get_system_property("ro.build.version.sdk_int");
|
||||
String sdk_version = get_system_property("ro.build.version.sdk");
|
||||
String build = get_system_property("ro.build.version.incremental");
|
||||
if (!sdk_version.is_empty()) {
|
||||
if (!build.is_empty()) {
|
||||
|
||||
Reference in New Issue
Block a user