From 9d78e0786bb68a555e59b20d46cef4426b27c949 Mon Sep 17 00:00:00 2001 From: Alexis Lopez Zubieta Date: Tue, 6 Nov 2018 07:48:12 -0600 Subject: [PATCH] Ensure that custom AppRun are deployed even if no desktop files are found --- src/core.cpp | 6 ++++++ tests/core/test_linuxdeploy.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/core.cpp b/src/core.cpp index bdb2fa1..bec36b8 100644 --- a/src/core.cpp +++ b/src/core.cpp @@ -57,6 +57,12 @@ namespace linuxdeploy { std::string customAppRunPath, appdir::AppDir& appDir) { ldLog() << std::endl << "-- Deploying files into AppDir root directory --" << std::endl; + if (!customAppRunPath.empty()) { + ldLog() << LD_WARNING << "Deploying custom AppRun: " << customAppRunPath << std::endl; + appDir.deployFile(customAppRunPath, appDir.path() / "AppRun"); + appDir.executeDeferredOperations(); + } + auto deployedDesktopFiles = appDir.deployedDesktopFiles(); if (deployedDesktopFiles.empty()) { ldLog() << LD_WARNING << "Could not find desktop file in AppDir, cannot create links for AppRun, " diff --git a/tests/core/test_linuxdeploy.cpp b/tests/core/test_linuxdeploy.cpp index dd6349d..042b692 100644 --- a/tests/core/test_linuxdeploy.cpp +++ b/tests/core/test_linuxdeploy.cpp @@ -89,4 +89,11 @@ namespace LinuxDeployTest { ASSERT_TRUE(exists(tmpAppDir / source_icon_path.filename())); ASSERT_TRUE(exists(target_apprun_path)); } + + TEST_F(LinuxDeployTestsFixture, deployAppDirRootFilesWithCustomAppRun) { + linuxdeploy::core::appdir::AppDir appDir(tmpAppDir); + linuxdeploy::deployAppDirRootFiles({}, source_apprun_path.string(), appDir); + + ASSERT_TRUE(exists(target_apprun_path)); + } }