microsoft/openvmm

Public

mirrored fromhttps://github.com/microsoft/openvmmAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
6d9f566744d8d46492a564b6663d29dfacfc3fcc

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

flowey/flowey_core/src/util.rs

21lines · modecode

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Utilities used by flowey_core and made avaiable for higher-level crates.
5
6use std::path::Path;
7
8/// Copies the contents of `src` into the directory `dst`.
9pub fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> std::io::Result<()> {
10 fs_err::create_dir_all(&dst)?;
11 for entry in fs_err::read_dir(src.as_ref())? {
12 let entry = entry?;
13 let dst = dst.as_ref().join(entry.file_name());
14 if entry.file_type()?.is_dir() {
15 copy_dir_all(entry.path(), dst)?;
16 } else {
17 fs_err::copy(entry.path(), dst)?;
18 }
19 }
20 Ok(())
21}
22