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

Local environment configuration is not respected for app file storage #2867

Open
rmartin16 opened this issue Sep 22, 2024 · 6 comments
Open
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support. windows The issue relates to Microsoft Windows support.

Comments

@rmartin16
Copy link
Member

rmartin16 commented Sep 22, 2024

Describe the bug

Toga makes assumptions about which file paths to use for toga.Paths; this can conflict with local machine configuration that should affect arbitrary application storage. For instance, on GTK, if I configure my XDG env vars to something other than the default values, then Toga will ignore this.

Steps to reproduce

For the system, configure application storage with values other than the default and run a Toga app that creates filesystem content.

Expected behavior

Toga should respect local machine configuration for application storage. Given this configuration can be complex on any given platform, the platformdirs package provides nice abstractions. In the least, their logic should be used on Desktop, I think. Outside of Linux distros going rogue....this is also probably important for enterprise environments where IT wants apps to work in a certain way.

Screenshots

No response

Environment

  • Operating System: all
  • Python version: all
  • Software versions:
    • Toga: 0.4.7

Logs

No response

Additional context

I see that #1964 confirms the same default behavior as platformdirs....but it seemed to have been a foregone conclusion that platformdirs would not become a dependency for Toga.

@rmartin16 rmartin16 added the bug A crash or error in behavior. label Sep 22, 2024
@MrStickyPiston
Copy link

This would remove the need to give flatpaks whole file system access, making it a lot more secure.

@freakboy3742 freakboy3742 added good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support. labels Sep 22, 2024
@freakboy3742
Copy link
Member

FWIW: The primary reason for avoiding a platformdirs dependency was that platformdirs didn't have any support for iOS or Android - and it was problematic to submit patches for those platforms, because iOS and Android weren't officially supported platforms.

Now that isn't the case, adding a platformdirs dependency would make more sense (assuming patches upstream have been submitted and accepted).

However, this bug notwithstanding, we've essentially got an implementation of platformdirs functionality, so I'm not sure we gain much by replacing a (mostly) working implementation with an external dependency.

So - my inclination would be to add the handling necessary to honour XDG variables natively to Toga, and leave it at that.

@rmartin16
Copy link
Member Author

It may also be worth evaluating the situation on Windows; it can be a bit more complicated than even the XDG environment variables on Linux since the Windows registry is involved as well....and Windows is likely more relevant to enterprise.

@freakboy3742 freakboy3742 added the windows The issue relates to Microsoft Windows support. label Sep 22, 2024
@HARSHC1503
Copy link

Hello
I have gone through the issue and we have provided you the source file also for the app file storage.
file storage.docx

This typically happens when the environment variables related to storage paths or services (e.g., local storage vs. cloud storage) are not being read or correctly utilized in the code. we have provided the steps for how to do the configuration for file storage properly detects and respects the local environment settings.

  • Check Environment Configuration:
  • Modify the Code to Respect Environment Variables
  • Conditional File Storage Logic

@freakboy3742
Copy link
Member

@HARSHC1503 Thanks, but a DOCX file isn't something we can use - if only because it's a format that can't be edited or opened from the GitHub interface.

If the document contains a text description, you can provide the text as a comment on this ticket. If it's a set of code changes, a pull request is the most useful way to contribute that change.

@MrStickyPiston
Copy link

Its a js file for cloud storage and idk why its even here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support. windows The issue relates to Microsoft Windows support.
Projects
None yet
Development

No branches or pull requests

4 participants