Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text files generate .uid when saved from editor #102465

Closed
KoBeWi opened this issue Feb 5, 2025 · 3 comments · Fixed by #102489
Closed

Text files generate .uid when saved from editor #102465

KoBeWi opened this issue Feb 5, 2025 · 3 comments · Fixed by #102489

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Feb 5, 2025

Tested versions

4.4 beta2

System information

W10

Issue description

When you open a text file (.txt, .cfg, etc.) in script editor and save it, it will create .uid file.
This is wrong for a couple reasons:

  • .uid files should be generated automatically when resource is detected. In this case it happens only when saving with the built-in editor.
  • TextFile does not expose any API that would allow to do anything useful, so the UID is useless. Surprisingly though, you can load it and it does return TextFile.
    Both come from the fact that TextFile is a fake resource. It does not exist in filesystem, only in memory when you decide to edit a text file. Thus it should not be treated as Resource.

Steps to reproduce

  1. Create a .txt file in a project.
  2. Open it in Script editor.
  3. Save.
  4. Look inside the folder 👀

Minimal reproduction project (MRP)

N/A

@monxa
Copy link
Contributor

monxa commented Feb 6, 2025

Reproduced on 71d80b2.

The weird thing is, that uid files exactly get created when you save from within the script editor:
No uid created for non-empty files added outside the editor.

I do agree, that uids for .txt (given no ImporterPlugin) make little sense, as they cannot be loaded as resources.

Also:
FileAccess.open("uid:://uid-to-resource", FLAGS) works,
while FileAccess.open("uid:://uid-to-text-file", FLAGS) throws "Invalid uid".

@akien-mga akien-mga added this to the 4.4 milestone Feb 6, 2025
@fire
Copy link
Member

fire commented Feb 6, 2025

If it's a type resource I would expect an uid. So not giving uids to sub-classes of type resources makes me uneasy.

@KoBeWi
Copy link
Member Author

KoBeWi commented Feb 6, 2025

As I said, TextFile is a fake Resource. It doesn't have associated ResourceLoader nor ResourceSaver, it exists purely in memory. Text files are useful only with FileAccess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants