Skip to content

Commit

Permalink
Use dunce to canonicalize RtcCore.working_directory on initializa…
Browse files Browse the repository at this point in the history
…tion.
  • Loading branch information
azriel91 authored and ctron committed Dec 16, 2024
1 parent e9a8ae4 commit fd3d79f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/config/rt/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ impl RtcCore {

let trunk_version = config.trunk_version.clone();

let working_directory = working_directory
.canonicalize()
let working_directory = dunce::canonicalize(&working_directory)
.with_context(|| format!("unable to canonicalize '{}'", working_directory.display()))?;

let dist =
Expand Down
7 changes: 1 addition & 6 deletions src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@ pub fn spawn_hooks(cfg: Arc<RtcBuild>, stage: PipelineStage) -> HookHandles {
.filter(|hook_cfg| hook_cfg.stage == stage)
.map(|hook_cfg| {
let mut command = Command::new(hook_cfg.command());
let current_dir = if cfg!(target_os = "windows") {
dunce::simplified(&cfg.core.working_directory)
} else {
cfg.core.working_directory.as_path()
};

command
.current_dir(current_dir)
.current_dir(&cfg.core.working_directory)
.args(hook_cfg.command_arguments())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
Expand Down
7 changes: 1 addition & 6 deletions src/pipelines/tailwind_css.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,11 @@ impl TailwindCss {
let rel_path = common::strip_prefix(&self.asset.path);
tracing::debug!(path = ?rel_path, "compiling tailwind css");

let current_dir = if cfg!(target_os = "windows") {
dunce::simplified(&self.cfg.core.working_directory)
} else {
self.cfg.core.working_directory.as_path()
};
common::run_command(
Application::TailwindCss.name(),
&tailwind,
&args,
current_dir,
&self.cfg.core.working_directory,
)
.await?;

Expand Down

0 comments on commit fd3d79f

Please sign in to comment.