Skip to content

Commit

Permalink
Don't search for .exe
Browse files Browse the repository at this point in the history
  • Loading branch information
willcrichton committed Sep 10, 2024
1 parent 12ece08 commit 07d5d64
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/pre-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,16 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup for Windows
- name: Install pnpm (Windows)
if: matrix.os == 'windows-latest'
uses: pnpm/action-setup@v4
with:
version: 9.9
- name: Install Node (Windows)
if: matrix.os == 'windows-latest'
uses: actions/setup-node@v4
with:
node-version: 20
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Cross-compile
Expand Down
23 changes: 9 additions & 14 deletions crates/depot/src/commands/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::{
use std::{fs::Permissions, os::unix::prelude::PermissionsExt};

use anyhow::{anyhow, ensure, Context, Result};
use cfg_if::cfg_if;
use futures::StreamExt;
use indicatif::{ProgressBar, ProgressStyle};

Expand All @@ -33,22 +32,12 @@ pub struct GlobalConfig {

const HOME_ENV_VAR: &str = "DEPOT_HOME";

fn pnpm_bin() -> &'static str {
cfg_if! {
if #[cfg(unix)] {
"pnpm"
} else {
"pnpm.exe"
}
}
}

fn find_pnpm(root: &Path) -> Option<PathBuf> {
let pnpm_in_root = root.join("bin").join(pnpm_bin());
let pnpm_in_root = root.join("bin").join("pnpm");
if pnpm_in_root.exists() {
Some(pnpm_in_root)
} else {
pathsearch::find_executable_in_path(pnpm_bin())
pathsearch::find_executable_in_path("pnpm")
}
}

Expand Down Expand Up @@ -159,7 +148,13 @@ impl SetupCommand {
let pnpm_path = find_pnpm(&config.root);
if pnpm_path.is_none() {
println!("Downloading pnpm from Github...");
let pnpm_dst = bindir.join(pnpm_bin());

#[cfg(unix)]
let pnpm_bin = "pnpm";
#[cfg(not(unix))]
let pnpm_bin = "pnpm.exe";

let pnpm_dst = bindir.join(pnpm_bin);
download_pnpm(&pnpm_dst).await?;
}

Expand Down

0 comments on commit 07d5d64

Please sign in to comment.