From ad9820c103e365ab1da91c4a1d7f561ab4b0b176 Mon Sep 17 00:00:00 2001 From: Catherine Date: Sun, 23 Jul 2023 00:45:50 +0000 Subject: [PATCH] Create symlink in tests to fix cargo-vendor builds. Closes #26. --- src/base_directories.rs | 7 +++++++ test_files/symlinks/config/.gitkeep | 0 test_files/symlinks/config/myapp | 1 - 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 test_files/symlinks/config/.gitkeep delete mode 120000 test_files/symlinks/config/myapp diff --git a/src/base_directories.rs b/src/base_directories.rs index ac4c13e..4bd54b8 100644 --- a/src/base_directories.rs +++ b/src/base_directories.rs @@ -1267,6 +1267,11 @@ mod test { let config_dir = format!("{}/config", symlinks_dir); let myapp_dir = format!("{}/myapp", config_dir); + if Path::new(&myapp_dir).exists() { + fs::remove_file(&myapp_dir).unwrap(); + } + std::os::unix::fs::symlink("../../user/config/myapp", &myapp_dir).unwrap(); + assert!(path_exists(&myapp_dir)); assert!(path_exists(&config_dir)); assert!(path_exists(&symlinks_dir)); @@ -1284,5 +1289,7 @@ mod test { xd.find_config_file("user_config.file").unwrap(), PathBuf::from(&format!("{}/user_config.file", myapp_dir)) ); + + fs::remove_file(&myapp_dir).unwrap(); } } diff --git a/test_files/symlinks/config/.gitkeep b/test_files/symlinks/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test_files/symlinks/config/myapp b/test_files/symlinks/config/myapp deleted file mode 120000 index 8bcfda7..0000000 --- a/test_files/symlinks/config/myapp +++ /dev/null @@ -1 +0,0 @@ -../../user/config/myapp \ No newline at end of file