2 * Copyright (C) 2017 Simon Fels <morphis@gravedo.de>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "anbox/utils/environment_file.h"
19 #include "anbox/utils.h"
25 EnvironmentFile::EnvironmentFile(const boost::filesystem::path &path) {
26 std::ifstream in(path.string());
28 while (std::getline(in, line)) {
29 auto tokens = utils::string_split(line, '=');
30 if (tokens.size() != 2)
32 data_[tokens[0]] = utils::strip_surrounding_quotes(tokens[1]);
36 std::string EnvironmentFile::value(const std::string &key, const std::string &default_value) const {
37 auto iter = data_.find(key);
38 if (iter == data_.end())