Appropriate value for root_cache_path under Linux?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Appropriate value for root_cache_path under Linux?

Postby VadZ » Fri Dec 29, 2023 8:59 am

Hello,

I'd like to ask for advice about the most appropriate default value for this path: its name makes me think that it should be something like "~/.cache/appname/cef" by default, but the comment in the header says that the default value used by CEF itself is actually "~/.config/cef_user_data", so maybe I should use "~/.config/appname/cef" instead?

According to the usual convention and XDG specification, "~/.config" should be used for "user-specific configuration files" while "~/.cache" is for "user-specific non-essential data files", but what describes better the files created by CEF?

I'm developing a library, so I can't know for sure what will the application use CEF for, and I'll provide a way to change this value in any case, but it would still be nice to use something appropriate by default.

Thanks in advance for any hints!
VadZ
Techie
 
Posts: 16
Joined: Wed Oct 18, 2023 7:02 pm

Re: Appropriate value for root_cache_path under Linux?

Postby magreenblatt » Fri Dec 29, 2023 11:18 am

It depends on whether your application wants the cache files to persist. Files in “~/.cache” may be periodically deleted by the OS whereas files in “~/.config” should not be.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Appropriate value for root_cache_path under Linux?

Postby KatrinaS » Fri Dec 29, 2023 12:21 pm

Well if it's for a library of sorts, stick to the naming convention, so "~/.config/cef_user_data/appname", but you can use whatever you like really, so if you want to use what you say then why not. I'd consider them (in the abstract) "user-specific non-essential data files" as (on Bindows at least) you can delete everything in there with no ill effects except for a minor performance hit as this bumf will need recreating :)
KatrinaS
Mentor
 
Posts: 83
Joined: Tue Jul 04, 2023 6:30 pm

Re: Appropriate value for root_cache_path under Linux?

Postby VadZ » Fri Dec 29, 2023 12:57 pm

magreenblatt wrote:It depends on whether your application wants the cache files to persist. Files in “~/.cache” may be periodically deleted by the OS whereas files in “~/.config” should not be.


Thanks, I understand the difference between ".cache" and ".config", what I don't know is whether CEF creates any files that really shouldn't be deleted there or not, i.e. if it's really a problem to lose them.

I also realize that this depends on the application needs, which is why I'm going to provide a way for the application to override this in any case, as I wrote, but I don't know what would be the most reasonable default choice.

If there is no good reason to not do it (e.g. unless CEF stores something really important there), I'll probably go with ".cache" because some people (including me, personally), keep their ".config" in Git to track changes to it and it doesn't seem useful track at least some files created by CEF.
VadZ
Techie
 
Posts: 16
Joined: Wed Oct 18, 2023 7:02 pm

Re: Appropriate value for root_cache_path under Linux?

Postby magreenblatt » Fri Dec 29, 2023 1:13 pm

The cache directory contains persistent state for web applications, such as cookies and localStorage. For more information see https://chromium.googlesource.com/chrom ... ata_dir.md
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Appropriate value for root_cache_path under Linux?

Postby VadZ » Fri Dec 29, 2023 8:41 pm

magreenblatt wrote:The cache directory contains persistent state for web applications, such as cookies and localStorage. For more information see https://chromium.googlesource.com/chrom ... ata_dir.md


Thanks, I'm embarrassed to say that I hadn't found this page myself, but it's indeed very useful.

However this page speaks of separate user data and cache directories while it seems like there is just one directory for both of them that can be specified at CEF level since your commit b5386249b (alloy: Remove CefSettings.user_data_path (fixes #3511), 2023-06-06). Ideally I'd like to use (a subdirectory of) ~/.config for the user data directory but put cache directory under ~/.cache. Is this possible? Should I set CHROME_USER_DATA_DIR in the environment to specify the former?

I.e. I guess the question is, what was the rationale behind that commit, is it really a bad idea to use separate locations for user data and cache now?

P.S. I can't access #3511, I don't know if it's supposed to be private or if it's some Atlassian weirdness.
VadZ
Techie
 
Posts: 16
Joined: Wed Oct 18, 2023 7:02 pm

Re: Appropriate value for root_cache_path under Linux?

Postby magreenblatt » Sat Dec 30, 2023 4:31 pm

this page speaks of separate user data and cache directories

Chromium has a “user data” directory containing “profile” directories. CEF has a “root cache path” directory containing “cache path” directories. These directories are equivalent (e.g “user data == “root cache path” and “profile” == “cache path”).
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 211 guests