Skip to content

Commit 95b4721

Browse files
committed
Derive .quilt sub-paths from DOT_QUILT_DIR
1 parent 156dc02 commit 95b4721

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

quilt-rs/src/paths.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ pub fn list_auth_hosts(data_dir: &Path) -> Vec<String> {
4646
hosts
4747
}
4848

49-
const LINEAGE_FILE: &str = ".quilt/data.json";
49+
// Paths below are relative to `DOT_QUILT_DIR`; every accessor joins them onto
50+
// `dot_quilt_dir()`, so `DOT_QUILT_DIR` stays the single source of the prefix
51+
// and a rename propagates without touching these.
52+
const LINEAGE_FILE: &str = "data.json";
5053

51-
const INSTALLED_DIR: &str = ".quilt/installed";
52-
// Local cache directory under `<data_dir>`. Distinct from the S3 key
54+
const INSTALLED_DIR: &str = "installed";
55+
// Local cache directory under `<data_dir>/.quilt`. Distinct from the S3 key
5356
// prefix of the same name in `quilt-uri::paths` — sharing the literal
5457
// value today is incidental, the two contracts can evolve independently.
55-
const MANIFEST_DIR: &str = ".quilt/packages";
56-
const OBJECTS_DIR: &str = ".quilt/objects";
58+
const MANIFEST_DIR: &str = "packages";
59+
const OBJECTS_DIR: &str = "objects";
5760

5861
pub use quilt_uri::paths::get_manifest_key;
5962
pub use quilt_uri::paths::tag_key;
@@ -106,32 +109,32 @@ impl DomainPaths {
106109

107110
/// Directory for storing installed manifests
108111
pub fn installed_manifests_dir(&self, namespace: &Namespace) -> PathBuf {
109-
self.root_dir
112+
self.dot_quilt_dir()
110113
.join(INSTALLED_DIR)
111114
.join(namespace.to_string())
112115
}
113116

114117
/// Path to the lineage file
115118
pub fn lineage(&self) -> PathBuf {
116-
self.root_dir.join(LINEAGE_FILE)
119+
self.dot_quilt_dir().join(LINEAGE_FILE)
117120
}
118121

119122
/// Path to the manifest cached in semi-temporary directory
120123
pub fn cached_manifest(&self, uri: &ManifestUri) -> PathBuf {
121-
self.root_dir
124+
self.dot_quilt_dir()
122125
.join(MANIFEST_DIR)
123126
.join(&uri.bucket)
124127
.join(&uri.hash)
125128
}
126129

127130
/// Directory for storing cached manifests for a bucket
128131
pub fn cached_manifests_dir(&self, bucket: &str) -> PathBuf {
129-
self.root_dir.join(MANIFEST_DIR).join(bucket)
132+
self.dot_quilt_dir().join(MANIFEST_DIR).join(bucket)
130133
}
131134

132135
/// Directory for storing pristine hashed files
133136
pub fn objects_dir(&self) -> PathBuf {
134-
self.root_dir.join(OBJECTS_DIR)
137+
self.dot_quilt_dir().join(OBJECTS_DIR)
135138
}
136139

137140
/// Path to the pristine hashed file
@@ -142,9 +145,9 @@ impl DomainPaths {
142145
/// What directories are essential when we initiate `LocalDomain`
143146
fn required(&self) -> Vec<PathBuf> {
144147
vec![
145-
self.root_dir.join(INSTALLED_DIR),
148+
self.dot_quilt_dir().join(INSTALLED_DIR),
146149
self.objects_dir(),
147-
self.root_dir.join(MANIFEST_DIR),
150+
self.dot_quilt_dir().join(MANIFEST_DIR),
148151
]
149152
}
150153

0 commit comments

Comments
 (0)