diff --git a/include/linuxdeploy/core/appdir.h b/include/linuxdeploy/core/appdir.h index d3f2323..d703fc5 100644 --- a/include/linuxdeploy/core/appdir.h +++ b/include/linuxdeploy/core/appdir.h @@ -39,7 +39,7 @@ namespace linuxdeploy { explicit AppDir(const std::string& path); // creates basic directory structure of an AppDir in "FHS" mode - bool createBasicStructure(); + bool createBasicStructure() const; // deploy shared library // @@ -67,38 +67,38 @@ namespace linuxdeploy { boost::filesystem::path deployFile(const boost::filesystem::path& from, const boost::filesystem::path& to); // create an relative symlink to at . - bool createRelativeSymlink(const boost::filesystem::path& target, const boost::filesystem::path& symlink); + bool createRelativeSymlink(const boost::filesystem::path& target, const boost::filesystem::path& symlink) const; // execute deferred copy operations bool executeDeferredOperations(); // return path to AppDir - boost::filesystem::path path(); + boost::filesystem::path path() const; // create a list of all icon paths in the AppDir - std::vector deployedIconPaths(); + std::vector deployedIconPaths() const; // create a list of all executable paths in the AppDir - std::vector deployedExecutablePaths(); + std::vector deployedExecutablePaths() const; // create a list of all desktop file paths in the AppDir - std::vector deployedDesktopFiles(); + std::vector deployedDesktopFiles() const; // create symlinks for AppRun, desktop file and icon in the AppDir root directory bool setUpAppDirRoot(const desktopfile::DesktopFile& desktopFile, boost::filesystem::path customAppRunPath = ""); // list all executables in /usr/bin // this function does not perform a recursive search, but only searches the bin directory - std::vector listExecutables(); + std::vector listExecutables() const; // list all shared libraries in /usr/lib // this function recursively searches the entire lib directory for shared libraries - std::vector listSharedLibraries(); + std::vector listSharedLibraries() const; // search for executables and libraries and deploy their dependencies // calling this function can turn sure file trees created by make install commands into working // AppDirs - bool deployDependenciesForExistingFiles(); + bool deployDependenciesForExistingFiles() const; // disable deployment of copyright files for this instance void setDisableCopyrightFilesDeployment(bool disable); diff --git a/src/core/appdir.cpp b/src/core/appdir.cpp index 4e93522..6cf4185 100644 --- a/src/core/appdir.cpp +++ b/src/core/appdir.cpp @@ -590,7 +590,7 @@ namespace linuxdeploy { AppDir::AppDir(const std::string& path) : AppDir(bf::path(path)) {} - bool AppDir::createBasicStructure() { + bool AppDir::createBasicStructure() const { std::vector dirPaths = { "usr/bin/", "usr/lib/", @@ -647,7 +647,7 @@ namespace linuxdeploy { return d->executeDeferredOperations(); } - boost::filesystem::path AppDir::path() { + boost::filesystem::path AppDir::path() const { return d->appDirPath; } @@ -677,7 +677,7 @@ namespace linuxdeploy { return foundPaths; } - std::vector AppDir::deployedIconPaths() { + std::vector AppDir::deployedIconPaths() const { auto icons = listFilesInDirectory(path() / "usr/share/icons/"); auto pixmaps = listFilesInDirectory(path() / "usr/share/pixmaps/", false); icons.reserve(pixmaps.size()); @@ -685,11 +685,11 @@ namespace linuxdeploy { return icons; } - std::vector AppDir::deployedExecutablePaths() { + std::vector AppDir::deployedExecutablePaths() const { return listFilesInDirectory(path() / "usr/bin/", false); } - std::vector AppDir::deployedDesktopFiles() { + std::vector AppDir::deployedDesktopFiles() const { std::vector desktopFiles; auto paths = listFilesInDirectory(path() / "usr/share/applications/", false); @@ -824,11 +824,11 @@ namespace linuxdeploy { return d->deployFile(from, to, true); } - bool AppDir::createRelativeSymlink(const bf::path& target, const bf::path& symlink) { + bool AppDir::createRelativeSymlink(const bf::path& target, const bf::path& symlink) const { return d->symlinkFile(target, symlink, true); } - std::vector AppDir::listExecutables() { + std::vector AppDir::listExecutables() const { std::vector executables; for (const auto& file : listFilesInDirectory(path() / "usr" / "bin", false)) { @@ -846,7 +846,7 @@ namespace linuxdeploy { return executables; } - std::vector AppDir::listSharedLibraries() { + std::vector AppDir::listSharedLibraries() const { std::vector sharedLibraries; for (const auto& file : listFilesInDirectory(path() / "usr" / "lib", true)) { @@ -868,7 +868,7 @@ namespace linuxdeploy { return sharedLibraries; } - bool AppDir::deployDependenciesForExistingFiles() { + bool AppDir::deployDependenciesForExistingFiles() const { for (const auto& executable : listExecutables()) { if (bf::is_symlink(executable)) continue;