craftablescience / VPKEdit

A CLI/GUI tool to create, read, and write several pack file formats.
https://developer.valvesoftware.com/wiki/VPKEdit
MIT License
260 stars 20 forks source link

Undescribable file transfer bug. #166

Closed flleeppyy closed 3 months ago

flleeppyy commented 3 months ago

Describe the Bug

I really don't know how to explain this, but it has to do with file transfers with video editors and them holding them file, then trying to drag files to a folder, and it just says it cant copy because the file is being held by premiere/kdenlive or whatever software.

https://github.com/user-attachments/assets/33900e92-cf7e-4877-a963-4e3be8b2d68f

To Reproduce

  1. Open premiere or a video editor
  2. drag in a file from a vpk
  3. drag ANOTHER file from a vpk
  4. File cant move because its being held by premiere
  5. Drag file to a folder instead of the editor
  6. More file errors

Operating System

Windows 10

craftablescience commented 3 months ago

Will look into this, hopefully Hitfilm has the same bug because I don't own Adobe products

craftablescience commented 3 months ago

Ok I think I know why this is happening. When file(s) are dragged out of the application, it's expecting the OS will move them to wherever they're being dragged to. When this doesn't happen, they stay in the temp dir. At EntryTree.cpp L452, files are added to the drag based on the contents of the temp dir, files that are already in the temp dir are included in the drag because of this. I wrote it this way because I expected the temp dir to always be empty at this point. When it adds the existing files in the temp dir to the drag, this conflicts with Premiere because Premiere copied the previously dragged file to the project folder already (not moved, copied, thanks Adobe) and that file is open in Premiere. I have a bit of code to delete the contents of the temp dir after the drag is complete just in case the OS doesn't like moving stuff, but it seems like that's not working.

So I think the easiest fix here is making a different temp dir in %localappdata%/Temp (or /tmp on the better OS) for each drag operation. Files not getting deleted from the temp dir when they're dragged on top of an application like Premiere is bleh but there's nothing I can do about that, and really I blame Windows for not deleting files in Temp on startup :trollface:

craftablescience commented 3 months ago

Thanks for the report btw