1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
5 #ifndef COMMON_UTILS_PATHS_H_
6 #define COMMON_UTILS_PATHS_H_
13 #include "common/utils/request.h"
15 namespace common_installer {
18 * \brief Helper function for getting backup path (used for recovery)
19 * based on package path
21 * \param pkg_path package path
25 std::filesystem::path GetBackupPathForPackagePath(
26 const std::filesystem::path& pkg_path);
29 * \brief Helper function for getting backup path (used for recovery)
30 * based on manifest file path
32 * \param manifest_path path to manifest file
36 std::filesystem::path GetBackupPathForManifestFile(
37 const std::filesystem::path& manifest_path);
40 * \brief Helper function for getting backup path (used for recovery)
43 * \param icon_path path to icon file
47 std::filesystem::path GetBackupPathForIconFile(
48 const std::filesystem::path& icon_path);
51 * @brief GetIconFileBackupExtension
52 * @return extension for backup icon files
54 std::string GetIconFileBackupExtension();
57 * \brief Helper function for getting backup path of zip (used for recovery)
60 * \param zip_path path to zip file
62 * \return backup path of zip
64 std::filesystem::path GetBackupPathForZipFile(
65 const std::filesystem::path& zip_path);
68 * @brief GetZipPackageLocation
69 * Returns location where zip package file must be copied during package
72 * @param pkg_path package path
73 * @param pkgid package id
75 * @return full path of zip package location
77 std::filesystem::path GetZipPackageLocation(
78 const std::filesystem::path& pkg_path,
79 const std::string& pkgid);
82 * @brief GetMountLocation
83 * Returns the mount point of zip package. This location is used to
86 * @param pkg_path package path for which zip mount location is being obtained
88 * @return full path of package mount point
90 std::filesystem::path GetMountLocation(
91 const std::filesystem::path& pkg_path);
94 * @brief GetExternalCardPath
95 * Returns full path to mounted filesystem of sd card
99 std::filesystem::path GetExternalCardPath();
102 * @brief GetExternalTepPath
103 * Returns external installation location for tep package
104 * @param request_mode request type
105 * @param uid user id of request
107 * @return full directory path
109 std::filesystem::path GetExternalTepPath(RequestMode request_mode, uid_t uid);
112 * @brief GetInternalTepPath
113 * Returns internal installation location for tep package
114 * @param pkg_path path of installation request
116 * @return full directory path
118 std::filesystem::path GetInternalTepPath(
119 const std::filesystem::path& pkg_path);
123 * Returns internal location for preinstalled global app icon
124 * @param base_path path of icon in application
125 * @param pkgid package id
126 * @param icon_filename filename of icon
127 * @param root_path root path of application
129 * @return full icon path
131 std::filesystem::path GetIconPath(const std::filesystem::path& base_path,
132 const std::string& pkgid,
133 const std::filesystem::path& icon_filename,
134 const std::filesystem::path& root_path);
137 * @brief IsExtendedStorageAvailable
138 * Returns true if the extended storage is available
140 * @return true is the extended storage is available, otherwise false
142 bool IsExtendedStorageAvailable();
144 } // namespace common_installer
146 #endif // COMMON_UTILS_PATHS_H_