Skip to content

EditorInterface::get_selected_paths() can return same file twice (favorite and non-favorite, design flaw) #112091

@adamscott

Description

@adamscott

Tested versions

  • Reproducible in: master (0fdb93c), Godot 4.0

System information

Godot v4.5.stable - macOS Tahoe (26.1.0) - Multi-window, 1 monitor - Metal (Forward+) - integrated Apple M3 Max (Apple9) - Apple M3 Max (16 threads) - 48.00 GiB memory

Issue description

EditorInterface::get_selected_paths() (which returns FileSystemDock::get_singleton()->get_selected_paths()) has a design flaw: it returns an array of paths (String), but it doesn't tell if the selected file was selected from the favorites or in the res:// tree.

It makes it possible to select "twice" a file (one favorite, and the same res:// file).

Image

Steps to reproduce

  1. Create an EditorScript script that prints EditorInterface.get_selected_paths()
  2. Favorite that script in the FileSystem dock.
  3. Select both the favorite item and the script in the res:// tree
  4. Run the created editor script.
  5. See that the array returns the same path twice.

Minimal reproduction project (MRP)

112091.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    For team assessment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions