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

Test files polluting AppData/Local directory #92097

Open
KoBeWi opened this issue May 18, 2024 · 1 comment
Open

Test files polluting AppData/Local directory #92097

KoBeWi opened this issue May 18, 2024 · 1 comment

Comments

@KoBeWi
Copy link
Member

KoBeWi commented May 18, 2024

Tested versions

4.3 dev f58a96c

System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 31.0.15.4633) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

Issue description

Some tests use ResourceSaver (and probably FileAccess) to write some test files. Example:

const String save_path_binary = OS::get_singleton()->get_cache_path().path_join("resource.res");
const String save_path_text = OS::get_singleton()->get_cache_path().path_join("resource.tres");
ResourceSaver::save(resource, save_path_binary);
ResourceSaver::save(resource, save_path_text);

The problem is that they save it without any subfolder, creating a mess in that directory. On Windows it's AppData/Local, which I doubt it's intended for such things.

There could be a helper method that returns a safe cache directory, which could be a sub-directory of the above folder (with ensured existence).

Steps to reproduce

  1. Run tests (godot.exe --test)

Minimal reproduction project (MRP)

N/A

@huwpascoe
Copy link

Windows has a temporary files folder for this purpose and an alias to access it:
%Temp%\file.txt expands to C:\Users\user\AppData\Local\Temp\file.txt

More to the point, the tests should clean up after themselves!

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

No branches or pull requests

2 participants