summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/worker.rs')
-rw-r--r--cli/worker.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/cli/worker.rs b/cli/worker.rs
index 3b09714d5..0b07bb4bf 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -393,6 +393,13 @@ impl CliMainWorker {
}
}
+// TODO(bartlomieju): this should be moved to some other place, added to avoid string
+// duplication between worker setups and `deno info` output.
+pub fn get_cache_storage_dir() -> PathBuf {
+ // Note: we currently use temp_dir() to avoid managing storage size.
+ std::env::temp_dir().join("deno_cache")
+}
+
#[derive(Clone)]
pub struct CliMainWorkerFactory {
shared: Arc<SharedWorkerState>,
@@ -529,10 +536,7 @@ impl CliMainWorkerFactory {
});
let cache_storage_dir = maybe_storage_key.map(|key| {
// TODO(@satyarohith): storage quota management
- // Note: we currently use temp_dir() to avoid managing storage size.
- std::env::temp_dir()
- .join("deno_cache")
- .join(checksum::gen(&[key.as_bytes()]))
+ get_cache_storage_dir().join(checksum::gen(&[key.as_bytes()]))
});
// TODO(bartlomieju): this is cruft, update FeatureChecker to spit out
@@ -729,10 +733,7 @@ fn create_web_worker_callback(
.resolve_storage_key(&args.main_module);
let cache_storage_dir = maybe_storage_key.map(|key| {
// TODO(@satyarohith): storage quota management
- // Note: we currently use temp_dir() to avoid managing storage size.
- std::env::temp_dir()
- .join("deno_cache")
- .join(checksum::gen(&[key.as_bytes()]))
+ get_cache_storage_dir().join(checksum::gen(&[key.as_bytes()]))
});
// TODO(bartlomieju): this is cruft, update FeatureChecker to spit out