Skip to content

Conversation

@p0358
Copy link

@p0358 p0358 commented Jan 26, 2026

So that it doesn't put these files into people's backups.

There were cache, temp and downloads sub-dirs previously, all ephemeral. I've put contents of first two directly into ~/.cache/maxima and the last one still as sub-dir.

I'm only unsure about download_queue.json, but it feels like it'd be better off also being in cache (if someone wiped cache during a download, it might not necessarily be safe to assume whatever download was going can be just resumed like that, because maybe they just restored their system from a backup after re-setting it up again, maybe game dirs are gone too, etc.)

Technically downloader and its queue could go into a state dir, but I think that would be overkill at that point, so let's keep things simple.

As for Windows, data_dir() is {FOLDERID_RoamingAppData}\_project_path_\data, while cache_dir() is {FOLDERID_LocalAppData}\_project_path_\cache. Well, I guess Origin/EA App do separate their files between these two in a similar fashion, I recall they were putting cached avatars into %LocalAppData% too...


fn zstate_path(id: &str, path: &str) -> Result<PathBuf, DownloaderError> {
let mut path = maxima_dir()?.join("temp/downloader").join(id).join(path);
let mut path = maxima_cache_dir()?.join("downloader").join(id).join(path);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this to be in cache and not in the temp directory?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about /tmp, since it's usually tmpfs so only tiny files can be put there; also might be more hassle:

Since /tmp/ is accessible to other users of the system, it is essential that files and subdirectories under this directory are only created with mkstemp(3), mkdtemp(3), and similar calls. For more details, see Using /tmp/ and /var/tmp/ Safely.

I'm not sure how big this particular folder is during downloads though, I see it has .eazstate files after it was finished at least. Might want to make Maxima wipe them after the download is finished regardless, while /tmp should be wiped on reboot (it will be if tmpfs), some people have really long uptime too... So removing them once they're not needed is the correct choice.

But if it's just these tiny files and you don't mind a third function like maxima_temp_dir(), then sure could do that (then we could put them in Windows's %TEMP% aka %APPDATA%\Local\Temp)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants