def safe_remove_file(filename, app):
data_file = filename<EOL>static_data_file = os.path.join("<STR_LIT>", data_file)<EOL>if data_file.split("<STR_LIT:.>")[-<NUM_LIT:1>] == "<STR_LIT>":<EOL><INDENT>if hasattr(app.builder, "<STR_LIT>") and static_data_file in app.builder.script_files:<EOL><INDENT>app.builder.script_files.remove(static_data_file)<EOL><DEDENT><DEDENT>elif data_file.split("<STR_LIT:.>")[-<NUM_LIT:1>] == "<STR_LIT>":<EOL><INDENT>if hasattr(app.builder, "<STR_LIT>") and static_data_file in app.builder.css_files:<EOL><INDENT>app.builder.css_files.remove(static_data_file)<EOL><DEDENT><DEDENT>
Removes a given resource file from builder resources.
Needed mostly during test, if multiple sphinx-build are started.
During these tests js/cass-files are not cleaned, so a css_file from run A is still registered in run B.

:param filename: filename to remove
:param app: app object
:return: None