mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Android Editor: Auto create nomedia file to hide project files in media apps
This commit is contained in:
parent
1f56d96cf2
commit
8e5e915013
2 changed files with 24 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue