Make sure .import folder exists before importing, in case user deleted it manually. Fixes #15315
This commit is contained in:
parent
db49f35ab8
commit
bb2341e813
2 changed files with 13 additions and 1 deletions
|
@ -1509,6 +1509,19 @@ void EditorFileSystem::_reimport_file(const String &p_file) {
|
||||||
|
|
||||||
void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
|
void EditorFileSystem::reimport_files(const Vector<String> &p_files) {
|
||||||
|
|
||||||
|
{ //check that .import folder exists
|
||||||
|
DirAccess *da = DirAccess::open("res://");
|
||||||
|
if (da->change_dir(".import") != OK) {
|
||||||
|
Error err = da->make_dir(".import");
|
||||||
|
if (err) {
|
||||||
|
memdelete(da);
|
||||||
|
ERR_EXPLAIN("Failed to create 'res://.import' folder.");
|
||||||
|
ERR_FAIL_COND(err != OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memdelete(da);
|
||||||
|
}
|
||||||
|
|
||||||
importing = true;
|
importing = true;
|
||||||
EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size());
|
EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size());
|
||||||
|
|
||||||
|
|
|
@ -389,7 +389,6 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
|
||||||
new_data.resize((last - first + 1) * format_channels);
|
new_data.resize((last - first + 1) * format_channels);
|
||||||
for (int i = first * format_channels; i < (last + 1) * format_channels; i++) {
|
for (int i = first * format_channels; i < (last + 1) * format_channels; i++) {
|
||||||
new_data[i - first * format_channels] = data[i];
|
new_data[i - first * format_channels] = data[i];
|
||||||
setc++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data = new_data;
|
data = new_data;
|
||||||
|
|
Loading…
Reference in a new issue