Mark methods const where possible

This commit is contained in:
TheAssassin 2019-07-27 16:37:16 +02:00
parent 3d766446d9
commit 3183ee2f4f
2 changed files with 18 additions and 18 deletions

View File

@ -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 <AppDir> relative symlink to <target> at <symlink>.
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<boost::filesystem::path> deployedIconPaths();
std::vector<boost::filesystem::path> deployedIconPaths() const;
// create a list of all executable paths in the AppDir
std::vector<boost::filesystem::path> deployedExecutablePaths();
std::vector<boost::filesystem::path> deployedExecutablePaths() const;
// create a list of all desktop file paths in the AppDir
std::vector<desktopfile::DesktopFile> deployedDesktopFiles();
std::vector<desktopfile::DesktopFile> 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 <AppDir>/usr/bin
// this function does not perform a recursive search, but only searches the bin directory
std::vector<boost::filesystem::path> listExecutables();
std::vector<boost::filesystem::path> listExecutables() const;
// list all shared libraries in <AppDir>/usr/lib
// this function recursively searches the entire lib directory for shared libraries
std::vector<boost::filesystem::path> listSharedLibraries();
std::vector<boost::filesystem::path> 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);

View File

@ -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<std::string> 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<bf::path> AppDir::deployedIconPaths() {
std::vector<bf::path> 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<bf::path> AppDir::deployedExecutablePaths() {
std::vector<bf::path> AppDir::deployedExecutablePaths() const {
return listFilesInDirectory(path() / "usr/bin/", false);
}
std::vector<DesktopFile> AppDir::deployedDesktopFiles() {
std::vector<DesktopFile> AppDir::deployedDesktopFiles() const {
std::vector<DesktopFile> 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<bf::path> AppDir::listExecutables() {
std::vector<bf::path> AppDir::listExecutables() const {
std::vector<bf::path> executables;
for (const auto& file : listFilesInDirectory(path() / "usr" / "bin", false)) {
@ -846,7 +846,7 @@ namespace linuxdeploy {
return executables;
}
std::vector<bf::path> AppDir::listSharedLibraries() {
std::vector<bf::path> AppDir::listSharedLibraries() const {
std::vector<bf::path> 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;