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

[feat] Introduce a appDataDir path #5263

Closed
danrot opened this issue Sep 22, 2022 · 4 comments · Fixed by #5272
Closed

[feat] Introduce a appDataDir path #5263

danrot opened this issue Sep 22, 2022 · 4 comments · Fixed by #5272
Labels
good first issue Good for newcomers priority: 3 low scope: api.js The @tauri-apps/api npm package status: backlog Issue is ready and we can work on it type: feature request

Comments

@danrot
Copy link

danrot commented Sep 22, 2022

Describe the problem

I am building an application using Tauri in which I would like to store some data in a file on the hard drive, so I was looking into the fs module. For available paths I have found this documentation. I feel like the correct path for storing my data on a linux system would be the dataDir path. However, this path only contains the path to the folder, without a folder for the application itself as in appDir, therefore I have to handle that on my own, which is a tedious task. Additionally I think that this is so common, that it would warrant another path preset.

Describe the solution you'd like

I would like to be able to use something like BaseDirectory.AppData, that stores data in a folder for my own application within dataDir.

Alternatives considered

No alternatives other than leaving it the way it is and handle that in the application itself come to my mind.

Additional context

No response

@amrbashir amrbashir added status: backlog Issue is ready and we can work on it scope: api.js The @tauri-apps/api npm package priority: 3 low good first issue Good for newcomers labels Sep 22, 2022
@caesar
Copy link
Contributor

caesar commented Sep 22, 2022

It would be worth considering a cohesive scheme for all the different app-specific directories - for example, config, data, cache, and probably others.

I would suggest:

  • appConfigDir (appDir would need to be kept as an alias for now to avoid a breaking change)
  • appDataDir
  • appCacheDir
  • I can't think of any others but maybe there are more?

Personally I think the current appDir is confusingly named anyway because I would expect it to point to the directory where the actual app is located, rather than to a config dir.

@amrbashir
Copy link
Member

I agree current appDir is misleading and as long as we don't introduce a breaking change, this could be a good addition in v1.2. However I think we could just introduce appConfigDir as a separate function without aliasing so it could have a documentation and would include @since tag

@caesar
Copy link
Contributor

caesar commented Sep 23, 2022

logDir is another one that could be renamed to appLogDir to fit with the rest

lucasfernog added a commit that referenced this issue Sep 28, 2022
Co-authored-by: Amr Bashir <amr.bashir2015@gmail.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
@danrot
Copy link
Author

danrot commented Sep 29, 2022

Wow, that was fast! Thank you, everybody!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers priority: 3 low scope: api.js The @tauri-apps/api npm package status: backlog Issue is ready and we can work on it type: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants