6 #include <boost/filesystem.hpp>
9 #include "desktopfile.h"
13 namespace linuxdeploy {
17 * Base class for AppDirs.
21 // private data class pattern
23 std::shared_ptr<PrivateData> d;
26 // default constructor
27 // construct AppDir from given path
28 // the directory will be created if it doesn't exist
29 explicit AppDir(const boost::filesystem::path& path);
31 // we don't want any copy/move(-assignment) behavior, therefore we delete those operators/constructors
32 AppDir(const AppDir&) = delete;
33 AppDir(AppDir&&) = delete;
34 void operator=(const AppDir&) = delete;
35 void operator=(AppDir&&) = delete;
37 // alternative constructor
38 // shortcut for using a normal string instead of a path
39 explicit AppDir(const std::string& path);
41 // creates basic directory structure of an AppDir in "FHS" mode
42 bool createBasicStructure() const;
44 // deploy shared library
46 // if destination is specified, the library is copied to this location, and the rpath is adjusted accordingly
47 // the dependencies are copied to the normal destination, though
48 bool deployLibrary(const boost::filesystem::path& path, const boost::filesystem::path& destination = "");
50 // force deploy shared library
52 // works like deployLibrary, except that it doesn't check the excludelist
53 // this is useful to deploy libraries and their dependencies that are blacklisted and would otherwise not be deployed
54 // the excludelist check is only disabled for the current library, and will be enabled for the dependencies again
55 bool forceDeployLibrary(const boost::filesystem::path& path, const boost::filesystem::path& destination = "");
58 bool deployExecutable(const boost::filesystem::path& path, const boost::filesystem::path& destination = "");
60 // deploy dependencies for ELF file in AppDir, without copying it into the library dir
62 // the dependencies end up in the regular location
63 bool deployDependenciesOnlyForElfFile(const boost::filesystem::path& elfFilePath, bool failSilentForNonElfFile = false);
65 // deploy desktop file
66 bool deployDesktopFile(const desktopfile::DesktopFile& desktopFile);
69 bool deployIcon(const boost::filesystem::path& path);
71 // deploy icon, changing its name to <target filename>.<ext>
72 bool deployIcon(const boost::filesystem::path& path, const std::string& targetFilename);
74 // deploy arbitrary file
75 boost::filesystem::path deployFile(const boost::filesystem::path& from, const boost::filesystem::path& to);
77 // copy arbitrary file (immediately)
78 bool copyFile(const boost::filesystem::path& from, const boost::filesystem::path& to, bool overwrite = false) const;
80 // create an <AppDir> relative symlink to <target> at <symlink>.
81 bool createRelativeSymlink(const boost::filesystem::path& target, const boost::filesystem::path& symlink) const;
83 // execute deferred copy operations
84 bool executeDeferredOperations();
86 // return path to AppDir
87 boost::filesystem::path path() const;
89 // create a list of all icon paths in the AppDir
90 std::vector<boost::filesystem::path> deployedIconPaths() const;
92 // create a list of all executable paths in the AppDir
93 std::vector<boost::filesystem::path> deployedExecutablePaths() const;
95 // create a list of all desktop file paths in the AppDir
96 std::vector<desktopfile::DesktopFile> deployedDesktopFiles() const;
98 // create symlinks for AppRun, desktop file and icon in the AppDir root directory
99 bool setUpAppDirRoot(const desktopfile::DesktopFile& desktopFile, boost::filesystem::path customAppRunPath = "");
101 // list all executables in <AppDir>/usr/bin
102 // this function does not perform a recursive search, but only searches the bin directory
103 std::vector<boost::filesystem::path> listExecutables() const;
105 // list all shared libraries in <AppDir>/usr/lib
106 // this function recursively searches the entire lib directory for shared libraries
107 std::vector<boost::filesystem::path> listSharedLibraries() const;
109 // search for executables and libraries and deploy their dependencies
110 // calling this function can turn sure file trees created by make install commands into working
112 bool deployDependenciesForExistingFiles() const;
114 // disable deployment of copyright files for this instance
115 void setDisableCopyrightFilesDeployment(bool disable);