blob: 9ef1a5bf3eaaddcf0b5959394fb2b564642f3ce1 [file] [log] [blame]
Tianjie Xuc1a5e262019-05-22 14:34:12 -07001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <string>
20
21// This class parses a given target file for the build properties and image files. Then it creates
22// and maintains the temporary files to simulate the block devices on host.
23class TargetFiles {
24 public:
25 TargetFiles(std::string path, std::string work_dir)
26 : path_(std::move(path)), work_dir_(std::move(work_dir)) {}
27
28 std::string GetProperty(const std::string_view key, const std::string_view default_value) const;
29
30 std::string FindBlockDeviceName(const std::string_view name) const;
31
32 private:
33 std::string path_; // Path to the target file.
34
35 std::string work_dir_; // A temporary directory to store the extracted image files
36};