Deno: store cache files in recommended standard location

Created on 8 Aug 2018  路  5Comments  路  Source: denoland/deno

I'm psyched about deno
I like decentralized library , sandbox by default

Just some nitpick

Instead of polluting home directory with ~/.deno

Use XDG Base Directory Specification for linux

Use Mac OS specific locations https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html#//apple_ref/doc/uid/TP40010672-CH10-SW1

Most helpful comment

IMO for windows you should use %localappdata%/deno as cache directory.

All 5 comments

IMO for windows you should use %localappdata%/deno as cache directory.

We should use the directories crate:

```rust
use directories::ProjectDirs;

let cache_dir = match ProjectDirs::from("land", "ry", "deno") {
Some(proj_dirs) => proj_dirs.cache_dir(),
None => // fallback to ~/.deno
}

You can control location of deno directory with DENO_DIR. Check out this article for more info.

CC @ry

@bartlomieju It's not about configuring ENVIRONMENT , but playing nicely with current conventions, and out box experience

That, and DENO_DIR sounds like it鈥檚 not exclusively for caches. If deno at some point does something else with it than storing its history and cache files in it, it won鈥檛 be sufficient anymore, as the cache dir isn鈥檛 equal to e.g. the config dir.

OSs have standards for directories. There鈥檚 crates implementing those standards. The standards are there because e.g. cache dirs don鈥檛 need to be backed up and can be cleaned on low disk space. So they need to be followed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

metakeule picture metakeule  路  3Comments

zugende picture zugende  路  3Comments

motss picture motss  路  3Comments

sh7dm picture sh7dm  路  3Comments

ry picture ry  路  3Comments