提交 d12aad5c 编写于 作者: S Simon Fels 提交者: GitHub

Merge pull request #34 from morphis/feature/minor-fixes

A few minor fixes to clean things up a bit
......@@ -95,7 +95,7 @@ start() {
fi
# Ensure FUSE support for user namespaces is enabled
echo Y > /sys/module/fuse/parameters/userns_mounts
echo Y | sudo tee /sys/module/fuse/parameters/userns_mounts || echo "WARNING: kernel doesn't support fuse in user namespaces"
exec $SNAP/usr/sbin/aa-exec -p unconfined -- $SNAP/bin/anbox-wrapper.sh container-manager
}
......
......@@ -88,9 +88,6 @@ parts:
# FIXME: Anbox currently has some paths with hard coded prefixes. Once
# that is fixed we can avoid using a prefix here.
- -DCMAKE_INSTALL_PREFIX:PATH=/usr
# FIXME: When building in release mode we get a lot of error which cause
# the build to fail.
- -DCMAKE_BUILD_TYPE=debug
build-packages:
- build-essential
- cmake
......@@ -104,6 +101,7 @@ parts:
- libboost-iostreams-dev
- libboost-program-options-dev
- libboost-system-dev
- libboost-test-dev
- libboost-thread-dev
- libcap-dev
- libdbus-1-dev
......
......@@ -48,10 +48,8 @@ void LauncherStorage::add(const Item &item) {
auto package_name = item.package;
std::replace(package_name.begin(), package_name.end(), '.', '-');
const auto item_path =
path_ / utils::string_format("anbox-%s.desktop", package_name);
const auto item_icon_path =
icon_path_ / utils::string_format("anbox-%s.png", package_name);
const auto item_path = path_ / utils::string_format("anbox-%s.desktop", package_name);
const auto item_icon_path = icon_path_ / utils::string_format("anbox-%s.png", package_name);
std::string exec = utils::string_format("%s launch ", utils::process_get_exe_path(getpid()));
......@@ -68,21 +66,23 @@ void LauncherStorage::add(const Item &item) {
exec += utils::string_format("--package=%s ", item.launch_intent.package);
if (!item.launch_intent.component.empty())
exec +=
utils::string_format("--component=%s ", item.launch_intent.component);
std::ofstream f(item_path.string());
f << "[Desktop Entry]" << std::endl
<< "Name=" << item.package << std::endl
<< "Exec=" << exec << std::endl
<< "Terminal=false" << std::endl
<< "Type=Application" << std::endl
<< "Icon=" << item_icon_path.string() << std::endl;
f.close();
f = std::ofstream(item_icon_path.string());
f.write(item.icon.data(), item.icon.size());
f.close();
exec += utils::string_format("--component=%s ", item.launch_intent.component);
if (auto desktop_item = std::ofstream(item_path.string())) {
desktop_item << "[Desktop Entry]" << std::endl
<< "Name=" << item.package << std::endl
<< "Exec=" << exec << std::endl
<< "Terminal=false" << std::endl
<< "Type=Application" << std::endl
<< "Icon=" << item_icon_path.string() << std::endl;
} else {
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create desktop item"));
}
if (auto icon = std::ofstream(item_icon_path.string()))
icon.write(item.icon.data(), item.icon.size());
else
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to write icon"));
}
} // namespace application
} // namespace anbox
......@@ -81,9 +81,6 @@ anbox::cmds::Run::Run(const BusFactory &bus_factory)
flag(cli::make_flag(cli::Name{"desktop_file_hint"},
cli::Description{"Desktop file hint for QtMir/Unity8"},
desktop_file_hint_));
flag(cli::make_flag(cli::Name{"icon"},
cli::Description{"Icon of the application to run"},
icon_));
action([this](const cli::Command::Context &) {
auto trap = core::posix::trap_signals_for_process(
......
......@@ -39,7 +39,6 @@ class Run : public cli::CommandWithFlagsAndAction {
private:
BusFactory bus_factory_;
std::string desktop_file_hint_;
std::string icon_;
};
} // namespace cmds
} // namespace anbox
......
......@@ -51,7 +51,7 @@ TEST(BufferedIOStream, CommitBufferWritesOutToMessenger) {
auto messenger = std::make_shared<MockSocketMessenger>();
BufferedIOStream stream(messenger);
const auto buffer_size{1000};
const size_t buffer_size{1000};
// We will write out the data we get in two junks of half the size
// the original buffer has.
EXPECT_CALL(*messenger, send_raw(_, buffer_size))
......@@ -75,8 +75,8 @@ TEST(BufferedIOStream, WriterContinuesWhenSocketIsBusy) {
auto messenger = std::make_shared<MockSocketMessenger>();
BufferedIOStream stream(messenger);
const auto buffer_size{1000};
const auto first_chunk_size{100};
const size_t buffer_size{1000};
const size_t first_chunk_size{100};
// The writer will check the error code of the send function
// and will retry writing the next chunk when it doesn't get
// EAGAIN anymore from the sender.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册