Skip to content

Conversation

cyphase
Copy link

@cyphase cyphase commented May 21, 2025

Refactored tests to respect XDG app path customization, and added the functionality for the GTK backend while marking it as not implemented on the other backends.

This fixes the problem of Linux users not having their app files stored in the place they've configured.

Fixes (partially) #2867 (since that mentions Windows as well).

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

This needs a changenote, and there's one suggestion inline about using a context manager; but otherwise this looks great!

@cyphase cyphase force-pushed the local-app-config-linux branch from b4cbb02 to 45e078d Compare May 22, 2025 21:05
@cyphase cyphase marked this pull request as ready for review May 22, 2025 21:19
@cyphase
Copy link
Author

cyphase commented May 22, 2025

Does this need any documentation beyond the changenote?

@rmartin16
Copy link
Member

I'm sure this is on Russell's radar...but as a doublecheck: while I agree this is a bugfix, I would also consider it a candidate for the Backward Incompatible Changes changelog section.

@cyphase cyphase closed this May 22, 2025
@cyphase cyphase reopened this May 22, 2025
@freakboy3742
Copy link
Member

Does this need any documentation beyond the changenote?

I'd say it's worth adding a platform note to the app paths docs. That page doesn't have a notes section at present, but a lot of other widgets have a Notes section to capture "platform quirks" and things like that (see MapView for one example).

As @rmartin16 notes - it's probably worth a removal note as well, as it could potentially break existing apps where users have saved data in a non-XDG location.

@cyphase
Copy link
Author

cyphase commented Jun 3, 2025

I've been thinking for the past week that today might be the day I could get back to this and finish it up, but some work things intervened. It's still very much my intention to finish this ASAP.

I haven't taken the coin out of the sleeve, or looked at it since I got back. Not until I properly earn it. 😆

Since Toga handles creating the root directories if they don't exist,
we don't want to create the parent folders here, so that it fails if
the directory wasn't created by Toga.
This is in preparation for a future change.
No backends implement it yet.
This commit also updates related documentation.
@cyphase cyphase force-pushed the local-app-config-linux branch from 45e078d to 31e5ad5 Compare September 12, 2025 21:35
@cyphase
Copy link
Author

cyphase commented Sep 12, 2025

I've updated this and it's almost ready to merge. One of the failing checks is a spelling issue I've already fixed locally (I added "config" to the word list).

The other three failing checks are because the GTK tests are testing different app paths, which is conflicting with the caching of app paths introduced in #3544 / #3669 (cc: @HalfWhitt ).

It seems that we can either remove the caching, which is a pretty minor optimization, or add some ability to clear the cache. Thoughts?

@HalfWhitt
Copy link
Member

It seems that we can either remove the caching, which is a pretty minor optimization, or add some ability to clear the cache. Thoughts?

The @cache decorator should provide that, i.e. Paths.config_path.clear_cache(). (Note that this is accessing via the class Paths, not the instance app.paths.)

I'm not currently at a computer to verify that works; it's possible I'm overlooking some detail of how exactly to properly access the function that's wrapped by the property...

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.

4 participants