18
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
#include "liblibertine/libertine.h"
21
#include "libertine/ContainerConfigList.h"
22
#include "libertine/LibertineConfig.h"
22
#include "common/ContainerConfigList.h"
23
#include "common/LibertineConfig.h"
77
78
GError* error = nullptr;
78
79
GArray* apps = g_array_new(TRUE, TRUE, sizeof(gchar*));
80
auto globalPath = g_build_filename("/", g_strdup(path), GLOBAL_APPLICATIONS, nullptr);
81
error = list_apps_from_path(globalPath, container_id, apps);
87
return (gchar**)g_array_free(apps, FALSE);
83
auto global_path = g_build_filename("/", g_strdup(path), GLOBAL_APPLICATIONS, nullptr);
84
error = list_apps_from_path(global_path, container_id, apps);
90
return (gchar**)g_array_free(apps, FALSE);
91
96
auto home_path = libertine_container_home_path(container_id);
92
auto local_path = g_build_filename(home_path, LOCAL_APPLICATIONS, nullptr);
97
if (home_path != nullptr)
99
auto local_path = g_build_filename(home_path, LOCAL_APPLICATIONS, nullptr);
101
error = list_apps_from_path(local_path, container_id, apps);
102
if (error != nullptr)
104
g_error_free(error); // free error, but return previously found apps
93
108
g_free(home_path);
95
error = list_apps_from_path(local_path, container_id, apps);
98
g_error_free(error); // free error, but return previously found apps
103
110
return (gchar**)g_array_free(apps, FALSE);
131
138
libertine_container_path(const gchar * container_id)
134
g_return_val_if_fail(container_id != NULL, NULL);
140
gchar * path = nullptr;
141
g_return_val_if_fail(container_id != nullptr, nullptr);
136
path = g_build_filename(g_get_user_cache_dir(), "libertine-container", container_id, "rootfs", NULL);
143
path = g_build_filename(g_get_user_cache_dir(), "libertine-container", container_id, "rootfs", nullptr);
138
145
if (g_file_test(path, G_FILE_TEST_EXISTS))
151
158
libertine_container_home_path(const gchar * container_id)
154
g_return_val_if_fail(container_id != NULL, NULL);
160
gchar * path = nullptr;
161
g_return_val_if_fail(container_id != nullptr, nullptr);
156
path = g_build_filename(g_get_user_data_dir(), "libertine-container", "user-data", container_id, NULL);
163
path = g_build_filename(g_get_user_data_dir(), "libertine-container", "user-data", container_id, nullptr);
158
165
if (g_file_test(path, G_FILE_TEST_EXISTS))