Standardize paths used under drag and drop action in Windows platform specfically#114555
Standardize paths used under drag and drop action in Windows platform specfically#114555onequid wants to merge 1 commit intogodotengine:masterfrom
Conversation
bruvzg
left a comment
There was a problem hiding this comment.
ERR_FAIL_COND_V_MSG(p_from == p_to, ERR_INVALID_PARAMETER, "Source and destination path are equal.");
This check likely should be DirAccess::is_equivalent(a, b) (if it works on directories on all platform, the method might need updating), which checks file system internal IDs instead of paths. simplify_path might be not sufficient for all cases.
|
I see. I was not aware of the And the |
3a2e90d to
b475845
Compare
AR-DEV-1
left a comment
There was a problem hiding this comment.
Just tested on Linux (Godot v4.6.beta.mono (5abc97c29) - Zorin OS 18 on Wayland - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - integrated Intel(R) HD Graphics 5500 (BDW GT2) - Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz (4 threads) - 7.67 GiB memory)
The PR works as described. It would detect if I was dragging & dropping the same file & would give the error. Though, the editor does freeze sometimes. Don't know if it's my computer or Godot. Would you take a look at it?
|
Thank you very much for the test . Did it freeze generally or just when assets were added? |
|
After a second thought I'd rather not change the
And thanks a lot for all the help and advice here. |
Standardize file paths and the temp dir path used under drag and drop action in Windows platform specifically using `simplify_path()` method.
b475845 to
7e05ac9
Compare
Generally, caused my computer to also crash. But, the logic seems fine to me. |
|
Adding a .png file from a web browser by drag-and-drop works on MacOS, as I was told. But it didn't work on Windows yet. Firstly with Before more efforts, whether this feature (drag-n-drop from a browser) is wanted or not? If it is wanted, should it create a download task like those are downloaded from "Asset Library", which it probably does not on MacOS/Unix now(need comfirm)? |
The paths of files/directories under drag-n-drop action from system file explorer to godot assets dock in Windows are standardized now.
It fixes the check here:
godot/core/io/dir_access.cpp
Lines 413 to 414 in f0aeea2
This also fixes the freeze of godot editor and duplicated tmp files after dragging and dropping files(assets) from OS File Explorer to where they already are, as is described here:
#114218 (comment)
Additionally,
create_temp_dir, which is used byhandle_filedescriptor_format, also returns a standardized path string.Update(Incapable)
The `DirAccessWindows::is_equivalent(a, b)` function compared hard driver information of paths, namely volume serial number, LowPart, HighPart. Only `DirAcessUnix` and `DirAccessWindows` implement the `is_equivalent(a, b)` function. `DirAcessUnix::is_equivalent(a, b)` is **NOT** tested yet, though it seems to work as it returns string comparison result if it failed checking file system ID.
Marked the PR as draft, before a Unix test or approval.
And though the
DirAccessWindows::is_equivalent(a, b)formats both the given path arguements withfix_path(p_path)function, the calling ofsimplify_path()should remain as they should be standardized.