aboutsummaryrefslogtreecommitdiff
path: root/src/integration/targets.rs
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-18 23:46:34 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-18 23:56:20 +0300
commita51a15914a5b29155022a1fd589d2bcc6409cadf (patch)
tree8602b6d94c811666d49e4c2aa7636bb6a9b0e8a3 /src/integration/targets.rs
parent60c040057e3949ae93ee88d495df09b4b848d22d (diff)
fix: support javascript integrations on windows
refs #1531
Diffstat (limited to 'src/integration/targets.rs')
-rw-r--r--src/integration/targets.rs38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/integration/targets.rs b/src/integration/targets.rs
index 2b4c5615..99c150a3 100644
--- a/src/integration/targets.rs
+++ b/src/integration/targets.rs
@@ -45,14 +45,22 @@ use super::{
QODERCLI_HOOK_INSTALL_NAME, QODERCLI_REMOVED_LIFECYCLE_HOOK_EVENTS,
};
+fn ensure_extension_dir(dir: &Path, agent: &str) -> io::Result<()> {
+ if dir.is_dir() {
+ return Ok(());
+ }
+ if dir.parent().is_some_and(|parent| parent.is_dir()) {
+ return fs::create_dir_all(dir);
+ }
+ Err(io::Error::other(format!(
+ "{agent} extension directory not found at {}. install {agent} first",
+ dir.display()
+ )))
+}
+
pub(crate) fn install_pi() -> io::Result<PathBuf> {
let dir = pi_extension_dir()?;
- if !dir.is_dir() {
- return Err(io::Error::other(format!(
- "pi extension directory not found at {}. install pi and create the extensions directory first",
- dir.display()
- )));
- }
+ ensure_extension_dir(&dir, "pi")?;
let path = dir.join(PI_EXTENSION_INSTALL_NAME);
fs::write(&path, PI_EXTENSION_ASSET)?;
@@ -61,23 +69,7 @@ pub(crate) fn install_pi() -> io::Result<PathBuf> {
pub(crate) fn install_omp() -> io::Result<OmpInstallPaths> {
let dir = omp_extension_dir()?;
- if !dir.is_dir() {
- if dir.parent().is_some_and(|parent| parent.is_dir()) {
- fs::create_dir_all(&dir)?;
- } else {
- return Err(io::Error::other(format!(
- "omp extension directory not found at {}. install omp and create the extensions directory first",
- dir.display()
- )));
- }
- }
-
- if !dir.is_dir() {
- return Err(io::Error::other(format!(
- "omp extension directory not found at {}. install omp and create the extensions directory first",
- dir.display()
- )));
- }
+ ensure_extension_dir(&dir, "omp")?;
let removed_legacy_pi_extension = remove_legacy_pi_extension_from_omp_dir(&dir)?;
let extension_path = dir.join(OMP_EXTENSION_INSTALL_NAME);