Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions cargo-shuttle/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
ffi::OsStr,
fs::{canonicalize, create_dir_all},
fs::{create_dir_all},
io::{self, ErrorKind},
path::PathBuf,
};
Expand Down Expand Up @@ -183,7 +183,26 @@ pub struct InitArgs {

// Helper function to parse and return the absolute path
fn parse_path(path: &OsStr) -> Result<PathBuf, io::Error> {
canonicalize(path).map_err(|e| {
#[cfg(target_os = "windows")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rutexd I really want to merge this. But will prefer a solution where we don't use cfg. Ie the same non-canonicalize code should work on both Windows and Unix. If you can push such an update, then we can merge this

{
let p = PathBuf::try_from(path).map_err(|e| {
io::Error::new(
ErrorKind::InvalidInput,
format!("could not turn {path:?} into a real path: {e}"),
)
})?;

let cwd = std::env::current_dir().map_err(|e| {
io::Error::new(
ErrorKind::InvalidInput,
format!("could not get current working dir: {e}"),
)
})?;
Ok(cwd.join(p))
}

#[cfg(target_os = "unix")]
std::fs::canonicalize(path).map_err(|e| {
io::Error::new(
ErrorKind::InvalidInput,
format!("could not turn {path:?} into a real path: {e}"),
Expand Down
2 changes: 1 addition & 1 deletion gateway/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl GatewayService {
/// * `args` - The [`Args`] with which the service was
/// started. Will be passed as [`Context`] to workers and state.
pub async fn init(args: ContextArgs, db: SqlitePool) -> Self {
let docker = Docker::connect_with_unix(&args.docker_host, 60, API_DEFAULT_VERSION).unwrap();
let docker = Docker::connect_with_local(&args.docker_host, 60, API_DEFAULT_VERSION).unwrap();

let container_settings = ContainerSettings::builder(&docker).from_args(&args).await;

Expand Down