1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Android Editor: Auto create nomedia file to hide project files in media apps

This commit is contained in:
Anish Mishra
2025-04-03 18:05:30 +05:30
parent 1f56d96cf2
commit 8e5e915013
2 changed files with 24 additions and 0 deletions

View File

@@ -1068,6 +1068,19 @@ void EditorFileSystem::scan() {
// to be loaded to continue the scan and reimportations.
if (first_scan) {
_first_scan_filesystem();
#ifdef ANDROID_ENABLED
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.
Ref<FileAccess> f = FileAccess::open(nomedia_file_path, FileAccess::WRITE);
if (f.is_null()) {
// .nomedia isn't so critical.
ERR_PRINT("Couldn't create .nomedia in project path.");
} else {
f->close();
}
}
#endif
}
_update_extensions();