|
1 | 1 | //! Hierarchical path management for the application |
2 | 2 |
|
3 | | -#[cfg(test)] |
4 | | -use std::collections::HashSet; |
5 | 3 | use std::env::VarError; |
6 | 4 | use std::path::{ |
7 | 5 | PathBuf, |
@@ -85,32 +83,6 @@ impl FileSystemChecker for RealFileSystem { |
85 | 83 | } |
86 | 84 | } |
87 | 85 |
|
88 | | -/// Test filesystem implementation |
89 | | -#[cfg(test)] |
90 | | -struct TestFileSystem { |
91 | | - existing_paths: HashSet<PathBuf>, |
92 | | -} |
93 | | - |
94 | | -#[cfg(test)] |
95 | | -impl TestFileSystem { |
96 | | - fn new() -> Self { |
97 | | - Self { |
98 | | - existing_paths: HashSet::new(), |
99 | | - } |
100 | | - } |
101 | | - |
102 | | - fn add_path(&mut self, path: impl Into<PathBuf>) { |
103 | | - self.existing_paths.insert(path.into()); |
104 | | - } |
105 | | -} |
106 | | - |
107 | | -#[cfg(test)] |
108 | | -impl FileSystemChecker for TestFileSystem { |
109 | | - fn exists(&self, path: &std::path::Path) -> bool { |
110 | | - self.existing_paths.contains(path) |
111 | | - } |
112 | | -} |
113 | | - |
114 | 86 | fn resolve_migrated_path_with_fs( |
115 | 87 | fs: &dyn FileSystemChecker, |
116 | 88 | home_dir: &std::path::Path, |
@@ -155,11 +127,11 @@ fn resolve_migrated_path_with_fs( |
155 | 127 | }, |
156 | 128 | (true, true) => { |
157 | 129 | warn!( |
158 | | - "Config conflict: Both .amazonq and .kiro {} configs exist, using .amazonq at: {}", |
| 130 | + "Config conflict: Both .amazonq and .kiro {} configs exist, using .kiro at: {}", |
159 | 131 | scope, |
160 | | - amazonq_base.display() |
| 132 | + kiro_base.display() |
161 | 133 | ); |
162 | | - amazonq_base.join(subpath) |
| 134 | + kiro_base.join(subpath) |
163 | 135 | }, |
164 | 136 | (false, false) => { |
165 | 137 | debug!( |
@@ -461,10 +433,37 @@ impl<'a> GlobalPaths<'a> { |
461 | 433 |
|
462 | 434 | #[cfg(test)] |
463 | 435 | mod migration_tests { |
464 | | - use std::path::Path; |
| 436 | + use std::collections::HashSet; |
| 437 | + use std::path::{ |
| 438 | + Path, |
| 439 | + PathBuf, |
| 440 | + }; |
465 | 441 |
|
466 | 442 | use super::*; |
467 | 443 |
|
| 444 | + /// Test filesystem implementation |
| 445 | + struct TestFileSystem { |
| 446 | + existing_paths: HashSet<PathBuf>, |
| 447 | + } |
| 448 | + |
| 449 | + impl TestFileSystem { |
| 450 | + fn new() -> Self { |
| 451 | + Self { |
| 452 | + existing_paths: HashSet::new(), |
| 453 | + } |
| 454 | + } |
| 455 | + |
| 456 | + fn add_path(&mut self, path: impl Into<PathBuf>) { |
| 457 | + self.existing_paths.insert(path.into()); |
| 458 | + } |
| 459 | + } |
| 460 | + |
| 461 | + impl FileSystemChecker for TestFileSystem { |
| 462 | + fn exists(&self, path: &std::path::Path) -> bool { |
| 463 | + self.existing_paths.contains(path) |
| 464 | + } |
| 465 | + } |
| 466 | + |
468 | 467 | #[test] |
469 | 468 | fn test_kiro_only_workspace() { |
470 | 469 | let mut fs = TestFileSystem::new(); |
@@ -499,8 +498,8 @@ mod migration_tests { |
499 | 498 | let current = Path::new("/current"); |
500 | 499 |
|
501 | 500 | let path = resolve_migrated_path_with_fs(&fs, home, current, false, "cli-agents"); |
502 | | - // Should prefer .amazonq when both exist |
503 | | - assert_eq!(path, Path::new("/current/.amazonq/cli-agents")); |
| 501 | + // Should prefer .kiro when both exist |
| 502 | + assert_eq!(path, Path::new("/current/.kiro/cli-agents")); |
504 | 503 | } |
505 | 504 |
|
506 | 505 | #[test] |
@@ -549,8 +548,8 @@ mod migration_tests { |
549 | 548 | let current = Path::new("/current"); |
550 | 549 |
|
551 | 550 | let path = resolve_migrated_path_with_fs(&fs, home, current, true, "cli-agents"); |
552 | | - // Should prefer .amazonq when both exist |
553 | | - assert_eq!(path, Path::new("/home/user/.aws/amazonq/cli-agents")); |
| 551 | + // Should prefer .kiro when both exist |
| 552 | + assert_eq!(path, Path::new("/home/user/.aws/kiro/cli-agents")); |
554 | 553 | } |
555 | 554 |
|
556 | 555 | #[test] |
|
0 commit comments