Skip to content

Commit

Permalink
Merge pull request #3756 from canonical/remove-default-mount-target-f…
Browse files Browse the repository at this point in the history
…rom-launch

[cli/launch] remove default mount target from --mount
  • Loading branch information
ricab authored Nov 21, 2024
2 parents 646a164 + af4f4ff commit d885441
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/client/cli/cmd/launch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,9 @@ mp::ParseCode cmd::Launch::parse_args(mp::ArgParser* parser)
for (const auto& value : parser->values(mountOption))
{
// this is needed so that Windows absolute paths are not split at the colon following the drive letter
auto colon_split = QRegularExpression{R"(^[A-Za-z]:[\\/].*)"}.match(value).hasMatch();
auto mount_source = value.section(':', 0, colon_split);
auto mount_target = value.section(':', colon_split + 1);
mount_target = mount_target.isEmpty() ? mount_source : mount_target;
const auto colon_split = QRegularExpression{R"(^[A-Za-z]:[\\/].*)"}.match(value).hasMatch();
const auto mount_source = value.section(':', 0, colon_split);
const auto mount_target = value.section(':', colon_split + 1);

// Validate source directory of client side mounts
QFileInfo source_dir(mount_source);
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ TEST_F(Client, launch_cmd_mount_option)
const QTemporaryDir fake_directory{};

const auto fake_source = fake_directory.path().toStdString();
const auto fake_target = fake_source;
const auto fake_target = "";
const auto instance_name = "some_instance";

const auto mount_matcher = make_mount_matcher(fake_source, fake_target, instance_name);
Expand Down

0 comments on commit d885441

Please sign in to comment.