@@ -126,9 +126,6 @@ static func open_xml_export_dialog(xml: String, file_name: String) -> void:
126126 )
127127
128128static func _finish_export (file_path : String , export_data : ImageExportData ) -> void :
129- if not (file_path .contains ("/Documents/" ) or file_path .contains ("/Download/" )):
130- OS .alert ("Saving is only allowed in the Documents or Download directories." , "Save Failed" )
131- return
132129 if file_path .get_extension ().is_empty ():
133130 file_path += "." + export_data .format
134131
@@ -184,13 +181,6 @@ static func open_xml_import_dialog(completion_callback: Callable) -> void:
184181
185182# On web, the completion callback can't use the full file path.
186183static func open_custom_import_dialog (extensions : PackedStringArray , completion_callback : Callable , multi_select := false ) -> void :
187- var permission := "android.permission.READ_MEDIA_IMAGES"
188- if Configs .current_sdk < 33 :
189- permission = "android.permission.READ_EXTERNAL_STORAGE"
190-
191- if not OS .request_permission (permission ):
192- return
193-
194184 var extensions_with_dots := PackedStringArray ()
195185 for extension in extensions :
196186 extensions_with_dots .append ("." + extension )
@@ -223,9 +213,13 @@ static func open_custom_import_dialog(extensions: PackedStringArray, completion_
223213# Preprocessing step where all files with wrong extensions are discarded.
224214static func _start_file_import_process (file_paths : PackedStringArray , completion_callback : Callable ,
225215allowed_extensions : PackedStringArray , show_incorrect_extension_errors := true ) -> void :
226- if not show_incorrect_extension_errors :
216+ if not file_paths .is_empty () and file_paths [0 ].begins_with ("content://" ):
217+ _file_import_proceed (file_paths , completion_callback )
218+ return
219+
220+ if (not show_incorrect_extension_errors ):
227221 for i in range (file_paths .size () - 1 , - 1 , - 1 ):
228- if not Utils .get_lowercase_extension (file_paths [i ]) in allowed_extensions :
222+ if ( not Utils .get_lowercase_extension (file_paths [i ]) in allowed_extensions ) :
229223 file_paths .remove_at (i )
230224 if not file_paths .is_empty ():
231225 _file_import_proceed (file_paths , completion_callback )
@@ -251,7 +245,7 @@ allowed_extensions: PackedStringArray, show_incorrect_extension_errors := true)
251245 passed_list = incorrect_extension_file_paths
252246 else :
253247 error_text += Translator .translate ("{file_name} was discarded." ).format (
254- {"file_name" : incorrect_extension_file_paths [0 ]. get_file ( )})
248+ {"file_name" : Utils . get_file_name ( incorrect_extension_file_paths [0 ], false )})
255249
256250 var options_dialog := OptionsDialogScene .instantiate ()
257251 HandlerGUI .add_dialog (options_dialog )
@@ -284,7 +278,7 @@ static func _file_import_proceed(file_paths: PackedStringArray, completion_callb
284278 var options_dialog := OptionsDialogScene .instantiate ()
285279 HandlerGUI .add_dialog (options_dialog )
286280 var error := Translator .translate ("{file_name} couldn't be opened." ).format (
287- {"file_name" : Utils .simplify_file_path (file_path ). get_file ( )})
281+ {"file_name" : Utils .get_file_name ( Utils . simplify_file_path (file_path ), false )})
288282 if not FileAccess .file_exists (file_path ):
289283 error += "\n " + Translator .translate ("Check if the file still exists in the selected file path." )
290284 if not file_paths .is_empty ():
0 commit comments