install option: install apk to base app data dir

The default location is $HOME/.local/share/android_translation_layer/_installed_apks_/
This commit is contained in:
Julian Winkler
2024-04-13 16:56:09 +02:00
parent 5e674e1410
commit 62f91e8d3e

View File

@@ -433,6 +433,10 @@ static void open(GtkApplication *app, GFile** files, gint nfiles, const gchar* h
g_mapped_file_unref(icon_file); g_mapped_file_unref(icon_file);
g_free(app_icon_path_full); g_free(app_icon_path_full);
} }
GFile *dest = g_file_new_build_filename(app_data_dir_base, "_installed_apks_", apk_name, NULL);
printf("installing %s to %s\n", apk_name, g_file_get_path(dest));
g_file_make_directory(g_file_get_parent(dest), NULL, NULL);
g_file_copy(files[0], dest, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL);
GString *desktop_entry = g_string_new( GString *desktop_entry = g_string_new(
"[Desktop Entry]\n" "[Desktop Entry]\n"
@@ -456,7 +460,7 @@ static void open(GtkApplication *app, GFile** files, gint nfiles, const gchar* h
g_string_append_printf(desktop_entry, "-w %d ", d->window_width); g_string_append_printf(desktop_entry, "-w %d ", d->window_width);
if (d->window_height) if (d->window_height)
g_string_append_printf(desktop_entry, "-h %d ", d->window_height); g_string_append_printf(desktop_entry, "-h %d ", d->window_height);
g_string_append_printf(desktop_entry, "%s\n", apk_classpath); g_string_append_printf(desktop_entry, "%s\n", g_file_get_path(dest));
struct dynamic_launcher_callback_data *cb_data = g_new(struct dynamic_launcher_callback_data, 1); struct dynamic_launcher_callback_data *cb_data = g_new(struct dynamic_launcher_callback_data, 1);
cb_data->desktop_file_id = g_strdup_printf("%s.desktop", package_name); cb_data->desktop_file_id = g_strdup_printf("%s.desktop", package_name);
cb_data->desktop_entry = g_string_free(desktop_entry, FALSE); cb_data->desktop_entry = g_string_free(desktop_entry, FALSE);