This function prepares a string for being "dropped" into the script editor. The string can be a resource path, node path or property name.
| 2198 | /// This function prepares a string for being "dropped" into the script editor. |
| 2199 | /// The string can be a resource path, node path or property name. |
| 2200 | static String _quote_drop_data(const String &str) { |
| 2201 | const bool using_single_quotes = EDITOR_GET("text_editor/completion/use_single_quotes"); |
| 2202 | |
| 2203 | String escaped = str.c_escape(); |
| 2204 | |
| 2205 | // If string is double quoted, there is no need to escape single quotes. |
| 2206 | // We can revert the extra escaping added in c_escape(). |
| 2207 | if (!using_single_quotes) { |
| 2208 | escaped = escaped.replace("\\'", "\'"); |
| 2209 | } |
| 2210 | |
| 2211 | return escaped.quote(using_single_quotes ? "'" : "\""); |
| 2212 | } |
| 2213 | |
| 2214 | static String _get_dropped_resource_line(const Ref<Resource> &p_resource, bool p_create_field, bool p_allow_uid) { |
| 2215 | String path = p_resource->get_path(); |
no test coverage detected