Skip to content

Commit

Permalink
Support single quote when dropping files to script
Browse files Browse the repository at this point in the history
  • Loading branch information
KoBeWi committed Jul 3, 2021
1 parent a8fb450 commit 5e593dd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions editor/plugins/script_text_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
}

if (d.has("type") && (String(d["type"]) == "files" || String(d["type"]) == "files_and_dirs")) {
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\"";
Array files = d["files"];

String text_to_drop;
Expand All @@ -1454,9 +1455,9 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
}

if (preload) {
text_to_drop += "preload(\"" + String(files[i]).c_escape() + "\")";
text_to_drop += "preload(" + String(files[i]).c_escape().quote(quote_style) + ")";
} else {
text_to_drop += "\"" + String(files[i]).c_escape() + "\"";
text_to_drop += String(files[i]).c_escape().quote(quote_style);
}
}

Expand Down

0 comments on commit 5e593dd

Please sign in to comment.