/* filesystem.c generated by valac 0.56.19, the Vala compiler
 * generated from filesystem.vala, do not modify */

#include <glib-object.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <archive.h>
#include <archive_entry.h>
#include <stdio.h>
#include <glib/gstdio.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <gobject/gvaluecollector.h>

#define PROTON_PLUS_UTILS_FILESYSTEM_S_IRWXUGO ((S_IRWXU | S_IRWXG) | S_IRWXO)
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PROTON_PLUS_UTILS_TYPE_FILESYSTEM (proton_plus_utils_filesystem_get_type ())
#define PROTON_PLUS_UTILS_FILESYSTEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROTON_PLUS_UTILS_TYPE_FILESYSTEM, ProtonPlusUtilsFilesystem))
#define PROTON_PLUS_UTILS_FILESYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROTON_PLUS_UTILS_TYPE_FILESYSTEM, ProtonPlusUtilsFilesystemClass))
#define PROTON_PLUS_UTILS_IS_FILESYSTEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROTON_PLUS_UTILS_TYPE_FILESYSTEM))
#define PROTON_PLUS_UTILS_IS_FILESYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROTON_PLUS_UTILS_TYPE_FILESYSTEM))
#define PROTON_PLUS_UTILS_FILESYSTEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROTON_PLUS_UTILS_TYPE_FILESYSTEM, ProtonPlusUtilsFilesystemClass))

typedef struct _ProtonPlusUtilsFilesystem ProtonPlusUtilsFilesystem;
typedef struct _ProtonPlusUtilsFilesystemClass ProtonPlusUtilsFilesystemClass;
typedef struct _ProtonPlusUtilsFilesystemPrivate ProtonPlusUtilsFilesystemPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef gboolean (*ProtonPlusUtilsFilesystemcancel_callback) (gpointer user_data);
typedef struct _Block14Data Block14Data;
#define _archive_write_free0(var) ((var == NULL) ? NULL : (var = (archive_write_free (var), NULL)))
#define _archive_read_free0(var) ((var == NULL) ? NULL : (var = (archive_read_free (var), NULL)))
#define _g_thread_unref0(var) ((var == NULL) ? NULL : (var = (g_thread_unref (var), NULL)))
typedef struct _ProtonPlusUtilsFilesystemExtractData ProtonPlusUtilsFilesystemExtractData;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _ProtonPlusUtilsFilesystemMakeSymlinkData ProtonPlusUtilsFilesystemMakeSymlinkData;
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _ProtonPlusUtilsFilesystemMoveFileData ProtonPlusUtilsFilesystemMoveFileData;
typedef struct _ProtonPlusUtilsFilesystemMoveDirectoryData ProtonPlusUtilsFilesystemMoveDirectoryData;
typedef struct _ProtonPlusUtilsFilesystemCopyDirectoryData ProtonPlusUtilsFilesystemCopyDirectoryData;
typedef struct _Block15Data Block15Data;
#define _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL)))
typedef struct _ProtonPlusUtilsFilesystemMoveDirContentsData ProtonPlusUtilsFilesystemMoveDirContentsData;
#define _closedir0(var) ((var == NULL) ? NULL : (var = (closedir (var), NULL)))
typedef struct _Block16Data Block16Data;
typedef struct _ProtonPlusUtilsFilesystemDeleteDirectoryData ProtonPlusUtilsFilesystemDeleteDirectoryData;
typedef struct _Block17Data Block17Data;
typedef struct _ProtonPlusUtilsFilesystemCreateDirectoryData ProtonPlusUtilsFilesystemCreateDirectoryData;
typedef struct _ProtonPlusUtilsParamSpecFilesystem ProtonPlusUtilsParamSpecFilesystem;

struct _ProtonPlusUtilsFilesystem {
	GTypeInstance parent_instance;
	volatile int ref_count;
	ProtonPlusUtilsFilesystemPrivate * priv;
};

struct _ProtonPlusUtilsFilesystemClass {
	GTypeClass parent_class;
	void (*finalize) (ProtonPlusUtilsFilesystem *self);
};

struct _Block14Data {
	int _ref_count_;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	gchar* output;
	gchar* install_location;
	gchar* tool_name;
	gchar* extension;
	ProtonPlusUtilsFilesystemcancel_callback cancel_callback;
	gpointer cancel_callback_target;
	gpointer _async_data_;
};

struct _ProtonPlusUtilsFilesystemExtractData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* install_location;
	gchar* tool_name;
	gchar* extension;
	ProtonPlusUtilsFilesystemcancel_callback cancel_callback;
	gpointer cancel_callback_target;
	gchar* result;
	Block14Data* _data14_;
	gchar* _tmp0_;
	GThread* _tmp1_;
	GThread* _tmp2_;
	gchar* _tmp3_;
};

struct _ProtonPlusUtilsFilesystemMakeSymlinkData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* link_location;
	gchar* target_path;
	gboolean result;
	GFile* link_file;
	GFile* _tmp0_;
	GFile* _tmp1_;
	gboolean link_deleted;
	gboolean link_created;
	GFile* _tmp2_;
	GError* _inner_error0_;
};

struct _ProtonPlusUtilsFilesystemMoveFileData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* source;
	gchar* destination;
	gboolean result;
	GFile* source_file;
	GFile* _tmp0_;
	GFile* destination_file;
	GFile* _tmp1_;
	gboolean _tmp2_;
	GFile* _tmp3_;
	GFile* _tmp4_;
	GError* e;
	GError* _tmp5_;
	const gchar* _tmp6_;
	GError* _inner_error0_;
};

struct _ProtonPlusUtilsFilesystemMoveDirectoryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* source;
	gchar* destination;
	gboolean result;
	gboolean copied;
};

struct _ProtonPlusUtilsFilesystemCopyDirectoryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* source;
	gchar* destination;
	gboolean result;
	GFile* src;
	GFile* _tmp0_;
	GFile* dest;
	GFile* _tmp1_;
	GFile* _tmp2_;
	FILE* _tmp3_;
	GFile* _tmp4_;
	GFile* _tmp5_;
	GFileEnumerator* enumerator;
	GFile* _tmp6_;
	GFileEnumerator* _tmp7_;
	GFileInfo* file_info;
	GFileInfo* _tmp8_;
	GFileEnumerator* _tmp9_;
	GFileInfo* _tmp10_;
	GFileInfo* _tmp11_;
	GFileInfo* _tmp12_;
	gchar* file_name;
	GFileInfo* _tmp13_;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	GFile* src_file;
	GFile* _tmp16_;
	const gchar* _tmp17_;
	GFile* _tmp18_;
	GFile* dest_file;
	GFile* _tmp19_;
	const gchar* _tmp20_;
	GFile* _tmp21_;
	GFileInfo* _tmp22_;
	GFile* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	GFile* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	GFile* _tmp29_;
	GFile* _tmp30_;
	GError* e;
	const gchar* _tmp31_;
	GError* _tmp32_;
	const gchar* _tmp33_;
	GError* _vala1_e;
	GError* _tmp34_;
	const gchar* _tmp35_;
	GError* _inner_error0_;
};

struct _Block15Data {
	int _ref_count_;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	gboolean output;
	gchar* source_dir;
	gchar* target_dir;
	gpointer _async_data_;
};

struct _ProtonPlusUtilsFilesystemMoveDirContentsData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* source_dir;
	gchar* target_dir;
	gboolean result;
	Block15Data* _data15_;
	GThread* _tmp0_;
	GThread* _tmp1_;
};

struct _Block16Data {
	int _ref_count_;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	gboolean output;
	gchar* path;
	gpointer _async_data_;
};

struct _ProtonPlusUtilsFilesystemDeleteDirectoryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* path;
	gboolean result;
	Block16Data* _data16_;
	GThread* _tmp0_;
	GThread* _tmp1_;
};

struct _Block17Data {
	int _ref_count_;
	GSourceFunc callback;
	gpointer callback_target;
	GDestroyNotify callback_target_destroy_notify;
	gboolean output;
	gchar* path;
	gpointer _async_data_;
};

struct _ProtonPlusUtilsFilesystemCreateDirectoryData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	gchar* path;
	gboolean result;
	Block17Data* _data17_;
	GThread* _tmp0_;
	GThread* _tmp1_;
};

struct _ProtonPlusUtilsParamSpecFilesystem {
	GParamSpec parent_instance;
};

static gpointer proton_plus_utils_filesystem_parent_class = NULL;

VALA_EXTERN gpointer proton_plus_utils_filesystem_ref (gpointer instance);
VALA_EXTERN void proton_plus_utils_filesystem_unref (gpointer instance);
VALA_EXTERN GParamSpec* proton_plus_utils_param_spec_filesystem (const gchar* name,
                                                     const gchar* nick,
                                                     const gchar* blurb,
                                                     GType object_type,
                                                     GParamFlags flags);
VALA_EXTERN void proton_plus_utils_value_set_filesystem (GValue* value,
                                             gpointer v_object);
VALA_EXTERN void proton_plus_utils_value_take_filesystem (GValue* value,
                                              gpointer v_object);
VALA_EXTERN gpointer proton_plus_utils_value_get_filesystem (const GValue* value);
VALA_EXTERN GType proton_plus_utils_filesystem_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProtonPlusUtilsFilesystem, proton_plus_utils_filesystem_unref)
static void proton_plus_utils_filesystem_extract_data_free (gpointer _data);
VALA_EXTERN void proton_plus_utils_filesystem_extract (const gchar* install_location,
                                           const gchar* tool_name,
                                           const gchar* extension,
                                           ProtonPlusUtilsFilesystemcancel_callback cancel_callback,
                                           gpointer cancel_callback_target,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_);
VALA_EXTERN gchar* proton_plus_utils_filesystem_extract_finish (GAsyncResult* _res_);
static gboolean proton_plus_utils_filesystem_extract_co (ProtonPlusUtilsFilesystemExtractData* _data_);
static Block14Data* block14_data_ref (Block14Data* _data14_);
static void block14_data_unref (void * _userdata_);
static gboolean _proton_plus_utils_filesystem_extract_co_gsource_func (gpointer self);
static void __lambda4_ (Block14Data* _data14_);
static gssize proton_plus_utils_filesystem_copy_data (struct archive* ar,
                                               struct archive* aw);
VALA_EXTERN void proton_plus_utils_filesystem_delete_directory (const gchar* path,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_utils_filesystem_delete_directory_finish (GAsyncResult* _res_);
static void ___lambda6_ (GObject* obj,
                  GAsyncResult* res);
static void ____lambda6__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static gpointer ___lambda4__gthread_func (gpointer self);
static guint8* _vala_array_dup10 (guint8* self,
                           gssize length);
VALA_EXTERN gchar* proton_plus_utils_filesystem_convert_bytes_to_string (gint64 size);
static void proton_plus_utils_filesystem_make_symlink_data_free (gpointer _data);
VALA_EXTERN void proton_plus_utils_filesystem_make_symlink (const gchar* link_location,
                                                const gchar* target_path,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_utils_filesystem_make_symlink_finish (GAsyncResult* _res_);
static gboolean proton_plus_utils_filesystem_make_symlink_co (ProtonPlusUtilsFilesystemMakeSymlinkData* _data_);
VALA_EXTERN gboolean proton_plus_utils_filesystem_delete_file (const gchar* path);
static void proton_plus_utils_filesystem_make_symlink_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_);
VALA_EXTERN gchar* proton_plus_utils_filesystem_get_file_content (const gchar* path,
                                                      gboolean use_uri);
VALA_EXTERN gboolean proton_plus_utils_filesystem_modify_file (const gchar* path,
                                                   const gchar* content);
VALA_EXTERN gboolean proton_plus_utils_filesystem_copy_symlink (const gchar* src_path,
                                                    const gchar* dest_path);
VALA_EXTERN void proton_plus_utils_filesystem_create_file (const gchar* path,
                                               const gchar* content,
                                               gboolean private_mode);
static gboolean proton_plus_utils_filesystem_delete_file_direct (const gchar* path);
static void proton_plus_utils_filesystem_move_file_data_free (gpointer _data);
VALA_EXTERN void proton_plus_utils_filesystem_move_file (const gchar* source,
                                             const gchar* destination,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_utils_filesystem_move_file_finish (GAsyncResult* _res_);
static gboolean proton_plus_utils_filesystem_move_file_co (ProtonPlusUtilsFilesystemMoveFileData* _data_);
static void proton_plus_utils_filesystem_move_file_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_);
static void proton_plus_utils_filesystem_move_directory_data_free (gpointer _data);
VALA_EXTERN void proton_plus_utils_filesystem_move_directory (const gchar* source,
                                                  const gchar* destination,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_utils_filesystem_move_directory_finish (GAsyncResult* _res_);
static gboolean proton_plus_utils_filesystem_move_directory_co (ProtonPlusUtilsFilesystemMoveDirectoryData* _data_);
VALA_EXTERN void proton_plus_utils_filesystem_copy_directory (const gchar* source,
                                                  const gchar* destination,
                                                  GAsyncReadyCallback _callback_,
                                                  gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_utils_filesystem_copy_directory_finish (GAsyncResult* _res_);
static void proton_plus_utils_filesystem_move_directory_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void proton_plus_utils_filesystem_copy_directory_data_free (gpointer _data);
static gboolean proton_plus_utils_filesystem_copy_directory_co (ProtonPlusUtilsFilesystemCopyDirectoryData* _data_);
static void proton_plus_utils_filesystem_copy_directory_ready (GObject* source_object,
                                                        GAsyncResult* _res_,
                                                        gpointer _user_data_);
static void proton_plus_utils_filesystem_move_dir_contents_data_free (gpointer _data);
VALA_EXTERN void proton_plus_utils_filesystem_move_dir_contents (const gchar* source_dir,
                                                     const gchar* target_dir,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_utils_filesystem_move_dir_contents_finish (GAsyncResult* _res_);
static gboolean proton_plus_utils_filesystem_move_dir_contents_co (ProtonPlusUtilsFilesystemMoveDirContentsData* _data_);
static Block15Data* block15_data_ref (Block15Data* _data15_);
static void block15_data_unref (void * _userdata_);
static gboolean _proton_plus_utils_filesystem_move_dir_contents_co_gsource_func (gpointer self);
static void __lambda7_ (Block15Data* _data15_);
static gpointer ___lambda7__gthread_func (gpointer self);
static gboolean proton_plus_utils_filesystem_delete_directory_direct (const gchar* path);
static void proton_plus_utils_filesystem_delete_directory_data_free (gpointer _data);
static gboolean proton_plus_utils_filesystem_delete_directory_co (ProtonPlusUtilsFilesystemDeleteDirectoryData* _data_);
static Block16Data* block16_data_ref (Block16Data* _data16_);
static void block16_data_unref (void * _userdata_);
static gboolean _proton_plus_utils_filesystem_delete_directory_co_gsource_func (gpointer self);
static void __lambda5_ (Block16Data* _data16_);
static gpointer ___lambda5__gthread_func (gpointer self);
static void proton_plus_utils_filesystem_create_directory_data_free (gpointer _data);
VALA_EXTERN void proton_plus_utils_filesystem_create_directory (const gchar* path,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_);
VALA_EXTERN gboolean proton_plus_utils_filesystem_create_directory_finish (GAsyncResult* _res_);
static gboolean proton_plus_utils_filesystem_create_directory_co (ProtonPlusUtilsFilesystemCreateDirectoryData* _data_);
static Block17Data* block17_data_ref (Block17Data* _data17_);
static void block17_data_unref (void * _userdata_);
static gboolean _proton_plus_utils_filesystem_create_directory_co_gsource_func (gpointer self);
static void __lambda8_ (Block17Data* _data17_);
static gpointer ___lambda8__gthread_func (gpointer self);
VALA_EXTERN guint64 proton_plus_utils_filesystem_get_directory_size (const gchar* path);
VALA_EXTERN ProtonPlusUtilsFilesystem* proton_plus_utils_filesystem_new (void);
VALA_EXTERN ProtonPlusUtilsFilesystem* proton_plus_utils_filesystem_construct (GType object_type);
static void proton_plus_utils_filesystem_finalize (ProtonPlusUtilsFilesystem * obj);
static GType proton_plus_utils_filesystem_get_type_once (void);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static void
proton_plus_utils_filesystem_extract_data_free (gpointer _data)
{
	ProtonPlusUtilsFilesystemExtractData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	g_slice_free (ProtonPlusUtilsFilesystemExtractData, _data_);
}

void
proton_plus_utils_filesystem_extract (const gchar* install_location,
                                      const gchar* tool_name,
                                      const gchar* extension,
                                      ProtonPlusUtilsFilesystemcancel_callback cancel_callback,
                                      gpointer cancel_callback_target,
                                      GAsyncReadyCallback _callback_,
                                      gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemExtractData* _data_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (install_location != NULL);
	g_return_if_fail (tool_name != NULL);
	g_return_if_fail (extension != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsFilesystemExtractData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_filesystem_extract_data_free);
	_tmp0_ = g_strdup (install_location);
	_g_free0 (_data_->install_location);
	_data_->install_location = _tmp0_;
	_tmp1_ = g_strdup (tool_name);
	_g_free0 (_data_->tool_name);
	_data_->tool_name = _tmp1_;
	_tmp2_ = g_strdup (extension);
	_g_free0 (_data_->extension);
	_data_->extension = _tmp2_;
	_data_->cancel_callback = cancel_callback;
	_data_->cancel_callback_target = cancel_callback_target;
	proton_plus_utils_filesystem_extract_co (_data_);
}

gchar*
proton_plus_utils_filesystem_extract_finish (GAsyncResult* _res_)
{
	gchar* result;
	ProtonPlusUtilsFilesystemExtractData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static Block14Data*
block14_data_ref (Block14Data* _data14_)
{
	g_atomic_int_inc (&_data14_->_ref_count_);
	return _data14_;
}

static void
block14_data_unref (void * _userdata_)
{
	Block14Data* _data14_;
	_data14_ = (Block14Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data14_->_ref_count_)) {
		_g_free0 (_data14_->output);
		(_data14_->callback_target_destroy_notify == NULL) ? NULL : (_data14_->callback_target_destroy_notify (_data14_->callback_target), NULL);
		_data14_->callback = NULL;
		_data14_->callback_target = NULL;
		_data14_->callback_target_destroy_notify = NULL;
		_g_free0 (_data14_->install_location);
		_g_free0 (_data14_->tool_name);
		_g_free0 (_data14_->extension);
		g_slice_free (Block14Data, _data14_);
	}
}

static gboolean
_proton_plus_utils_filesystem_extract_co_gsource_func (gpointer self)
{
	gboolean result;
	result = proton_plus_utils_filesystem_extract_co (self);
	return result;
}

static void
___lambda6_ (GObject* obj,
             GAsyncResult* res)
{
	g_return_if_fail (res != NULL);
	proton_plus_utils_filesystem_delete_directory_finish (res);
}

static void
____lambda6__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	___lambda6_ (source_object, res);
}

static void
__lambda4_ (Block14Data* _data14_)
{
	static const gint bufferSize = 192000;
	struct archive* archive = NULL;
	struct archive* _tmp0_;
	struct archive* _tmp1_;
	struct archive* _tmp2_;
	gint flags = 0;
	struct archive* ext = NULL;
	struct archive* _tmp3_;
	struct archive* _tmp4_;
	struct archive* _tmp5_;
	struct archive* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gboolean _tmp11_;
	gssize r = 0L;
	struct archive_entry* entry = NULL;
	gchar* sourcePath = NULL;
	gchar* _tmp13_;
	gboolean firstRun = FALSE;
	struct archive* _tmp44_;
	const gchar* _tmp45_;
	gchar* _tmp46_;
	GSourceFunc _tmp48_;
	gpointer _tmp48__target;
	GDestroyNotify _tmp48__target_destroy_notify;
	_tmp0_ = archive_read_new ();
	archive = _tmp0_;
	_tmp1_ = archive;
	archive_read_support_format_all (_tmp1_);
	_tmp2_ = archive;
	archive_read_support_filter_all (_tmp2_);
	flags = (gint) ARCHIVE_EXTRACT_ACL;
	flags |= (gint) ARCHIVE_EXTRACT_PERM;
	flags |= (gint) ARCHIVE_EXTRACT_TIME;
	flags |= (gint) ARCHIVE_EXTRACT_FFLAGS;
	_tmp3_ = archive_write_disk_new ();
	ext = _tmp3_;
	_tmp4_ = ext;
	archive_write_disk_set_standard_lookup (_tmp4_);
	_tmp5_ = ext;
	archive_write_disk_set_options (_tmp5_, flags);
	_tmp6_ = archive;
	_tmp7_ = g_strconcat (_data14_->install_location, _data14_->tool_name, NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strconcat (_tmp8_, _data14_->extension, NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = archive_read_open_filename (_tmp6_, _tmp10_, (gsize) bufferSize) != ARCHIVE_OK;
	_g_free0 (_tmp10_);
	_g_free0 (_tmp8_);
	if (_tmp11_) {
		GSourceFunc _tmp12_;
		gpointer _tmp12__target;
		GDestroyNotify _tmp12__target_destroy_notify;
		_tmp12_ = _data14_->callback;
		_tmp12__target = _data14_->callback_target;
		_tmp12__target_destroy_notify = _data14_->callback_target_destroy_notify;
		_data14_->callback = NULL;
		_data14_->callback_target = NULL;
		_data14_->callback_target_destroy_notify = NULL;
		g_idle_add_full (G_PRIORITY_DEFAULT, _tmp12_, _tmp12__target, _tmp12__target_destroy_notify);
		_archive_write_free0 (ext);
		_archive_read_free0 (archive);
		return;
	}
	_tmp13_ = g_strdup ("");
	sourcePath = _tmp13_;
	firstRun = TRUE;
	{
		gboolean _tmp14_ = FALSE;
		_tmp14_ = TRUE;
		while (TRUE) {
			struct archive* _tmp15_;
			struct archive_entry* _tmp16_ = NULL;
			int _tmp17_;
			struct archive_entry* _tmp25_;
			struct archive_entry* _tmp26_;
			const gchar* _tmp27_;
			gchar* _tmp28_;
			gchar* _tmp29_;
			struct archive* _tmp30_;
			struct archive_entry* _tmp31_;
			struct archive* _tmp39_;
			if (!_tmp14_) {
			}
			_tmp14_ = FALSE;
			if (_data14_->cancel_callback (_data14_->cancel_callback_target)) {
				break;
			}
			_tmp15_ = archive;
			_tmp17_ = archive_read_next_header (_tmp15_, &_tmp16_);
			entry = _tmp16_;
			r = (gssize) _tmp17_;
			if (r == ((gssize) ARCHIVE_EOF)) {
				break;
			}
			if (r < ((gssize) ARCHIVE_OK)) {
				FILE* _tmp18_;
				struct archive* _tmp19_;
				const gchar* _tmp20_;
				_tmp18_ = stderr;
				_tmp19_ = ext;
				_tmp20_ = archive_error_string (_tmp19_);
				fprintf (_tmp18_, "%s", _tmp20_);
			}
			if (r < ((gssize) ARCHIVE_WARN)) {
				GSourceFunc _tmp21_;
				gpointer _tmp21__target;
				GDestroyNotify _tmp21__target_destroy_notify;
				_tmp21_ = _data14_->callback;
				_tmp21__target = _data14_->callback_target;
				_tmp21__target_destroy_notify = _data14_->callback_target_destroy_notify;
				_data14_->callback = NULL;
				_data14_->callback_target = NULL;
				_data14_->callback_target_destroy_notify = NULL;
				g_idle_add_full (G_PRIORITY_DEFAULT, _tmp21_, _tmp21__target, _tmp21__target_destroy_notify);
				_g_free0 (sourcePath);
				_archive_write_free0 (ext);
				_archive_read_free0 (archive);
				return;
			}
			if (firstRun) {
				struct archive_entry* _tmp22_;
				const gchar* _tmp23_;
				gchar* _tmp24_;
				_tmp22_ = entry;
				_tmp23_ = archive_entry_pathname (_tmp22_);
				_tmp24_ = g_strdup (_tmp23_);
				_g_free0 (sourcePath);
				sourcePath = _tmp24_;
				firstRun = FALSE;
			}
			_tmp25_ = entry;
			_tmp26_ = entry;
			_tmp27_ = archive_entry_pathname (_tmp26_);
			_tmp28_ = g_strconcat (_data14_->install_location, _tmp27_, NULL);
			_tmp29_ = _tmp28_;
			archive_entry_set_pathname (_tmp25_, _tmp29_);
			_g_free0 (_tmp29_);
			_tmp30_ = ext;
			_tmp31_ = entry;
			r = (gssize) archive_write_header (_tmp30_, _tmp31_);
			if (r < ((gssize) ARCHIVE_OK)) {
				FILE* _tmp32_;
				struct archive* _tmp33_;
				const gchar* _tmp34_;
				_tmp32_ = stderr;
				_tmp33_ = ext;
				_tmp34_ = archive_error_string (_tmp33_);
				fprintf (_tmp32_, "%s", _tmp34_);
			} else {
				struct archive_entry* _tmp35_;
				_tmp35_ = entry;
				if (archive_entry_size (_tmp35_) > ((la_int64_t) 0)) {
					struct archive* _tmp36_;
					struct archive* _tmp37_;
					_tmp36_ = archive;
					_tmp37_ = ext;
					r = proton_plus_utils_filesystem_copy_data (_tmp36_, _tmp37_);
					if (r < ((gssize) ARCHIVE_WARN)) {
						GSourceFunc _tmp38_;
						gpointer _tmp38__target;
						GDestroyNotify _tmp38__target_destroy_notify;
						_tmp38_ = _data14_->callback;
						_tmp38__target = _data14_->callback_target;
						_tmp38__target_destroy_notify = _data14_->callback_target_destroy_notify;
						_data14_->callback = NULL;
						_data14_->callback_target = NULL;
						_data14_->callback_target_destroy_notify = NULL;
						g_idle_add_full (G_PRIORITY_DEFAULT, _tmp38_, _tmp38__target, _tmp38__target_destroy_notify);
						_g_free0 (sourcePath);
						_archive_write_free0 (ext);
						_archive_read_free0 (archive);
						return;
					}
				}
			}
			_tmp39_ = ext;
			r = (gssize) archive_write_finish_entry (_tmp39_);
			if (r < ((gssize) ARCHIVE_OK)) {
				FILE* _tmp40_;
				struct archive* _tmp41_;
				const gchar* _tmp42_;
				_tmp40_ = stderr;
				_tmp41_ = ext;
				_tmp42_ = archive_error_string (_tmp41_);
				fprintf (_tmp40_, "%s", _tmp42_);
			}
			if (r < ((gssize) ARCHIVE_WARN)) {
				GSourceFunc _tmp43_;
				gpointer _tmp43__target;
				GDestroyNotify _tmp43__target_destroy_notify;
				_tmp43_ = _data14_->callback;
				_tmp43__target = _data14_->callback_target;
				_tmp43__target_destroy_notify = _data14_->callback_target_destroy_notify;
				_data14_->callback = NULL;
				_data14_->callback_target = NULL;
				_data14_->callback_target_destroy_notify = NULL;
				g_idle_add_full (G_PRIORITY_DEFAULT, _tmp43_, _tmp43__target, _tmp43__target_destroy_notify);
				_g_free0 (sourcePath);
				_archive_write_free0 (ext);
				_archive_read_free0 (archive);
				return;
			}
		}
	}
	_tmp44_ = archive;
	archive_read_close (_tmp44_);
	_tmp45_ = sourcePath;
	_tmp46_ = g_strconcat (_data14_->install_location, _tmp45_, NULL);
	_g_free0 (_data14_->output);
	_data14_->output = _tmp46_;
	if (_data14_->cancel_callback (_data14_->cancel_callback_target)) {
		gchar* _tmp47_;
		proton_plus_utils_filesystem_delete_directory (_data14_->output, ____lambda6__gasync_ready_callback, NULL);
		_tmp47_ = g_strdup ("");
		_g_free0 (_data14_->output);
		_data14_->output = _tmp47_;
	}
	_tmp48_ = _data14_->callback;
	_tmp48__target = _data14_->callback_target;
	_tmp48__target_destroy_notify = _data14_->callback_target_destroy_notify;
	_data14_->callback = NULL;
	_data14_->callback_target = NULL;
	_data14_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT, _tmp48_, _tmp48__target, _tmp48__target_destroy_notify);
	_g_free0 (sourcePath);
	_archive_write_free0 (ext);
	_archive_read_free0 (archive);
}

static gpointer
___lambda4__gthread_func (gpointer self)
{
	gpointer result;
	__lambda4_ (self);
	result = NULL;
	block14_data_unref (self);
	return result;
}

static gboolean
proton_plus_utils_filesystem_extract_co (ProtonPlusUtilsFilesystemExtractData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data14_ = g_slice_new0 (Block14Data);
	_data_->_data14_->_ref_count_ = 1;
	_g_free0 (_data_->_data14_->install_location);
	_data_->_data14_->install_location = _data_->install_location;
	_g_free0 (_data_->_data14_->tool_name);
	_data_->_data14_->tool_name = _data_->tool_name;
	_g_free0 (_data_->_data14_->extension);
	_data_->_data14_->extension = _data_->extension;
	_data_->_data14_->cancel_callback = _data_->cancel_callback;
	_data_->_data14_->cancel_callback_target = _data_->cancel_callback_target;
	_data_->_data14_->_async_data_ = _data_;
	_data_->_data14_->callback = _proton_plus_utils_filesystem_extract_co_gsource_func;
	_data_->_data14_->callback_target = _data_;
	_data_->_data14_->callback_target_destroy_notify = NULL;
	_data_->_tmp0_ = g_strdup ("");
	_data_->_data14_->output = _data_->_tmp0_;
	_data_->_tmp1_ = g_thread_new ("extract", ___lambda4__gthread_func, block14_data_ref (_data_->_data14_));
	_data_->_tmp2_ = _data_->_tmp1_;
	_g_thread_unref0 (_data_->_tmp2_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp3_ = g_strdup (_data_->_data14_->output);
	_data_->result = _data_->_tmp3_;
	block14_data_unref (_data_->_data14_);
	_data_->_data14_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static guint8*
_vala_array_dup10 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static gssize
proton_plus_utils_filesystem_copy_data (struct archive* ar,
                                        struct archive* aw)
{
	gssize r = 0L;
	guint8* buffer = NULL;
	gint buffer_length1 = 0;
	gint _buffer_size_ = 0;
	la_int64_t offset = {0};
	gssize result;
	g_return_val_if_fail (ar != NULL, -1L);
	g_return_val_if_fail (aw != NULL, -1L);
	{
		gboolean _tmp0_ = FALSE;
		_tmp0_ = TRUE;
		while (TRUE) {
			guint8* _tmp1_ = NULL;
			size_t _tmp2_ = 0;
			la_int64_t _tmp3_ = {0};
			int _tmp4_;
			guint8* _tmp5_;
			gint _tmp5__length1;
			guint8* _tmp6_;
			gint _tmp6__length1;
			if (!_tmp0_) {
			}
			_tmp0_ = FALSE;
			_tmp4_ = archive_read_data_block (ar, &_tmp1_, &_tmp2_, &_tmp3_);
			buffer = (g_free (buffer), NULL);
			_tmp5_ = (_tmp1_ != NULL) ? _vala_array_dup10 (_tmp1_, _tmp2_) : _tmp1_;
			_tmp5__length1 = _tmp2_;
			buffer = _tmp5_;
			buffer_length1 = _tmp5__length1;
			_buffer_size_ = buffer_length1;
			offset = _tmp3_;
			r = (gssize) _tmp4_;
			if (r == ((gssize) ARCHIVE_EOF)) {
				result = (gssize) ARCHIVE_OK;
				buffer = (g_free (buffer), NULL);
				return result;
			}
			if (r < ((gssize) ARCHIVE_OK)) {
				result = r;
				buffer = (g_free (buffer), NULL);
				return result;
			}
			_tmp6_ = buffer;
			_tmp6__length1 = buffer_length1;
			r = archive_write_data_block (aw, _tmp6_, (size_t) _tmp6__length1, offset);
			if (r < ((gssize) ARCHIVE_OK)) {
				FILE* _tmp7_;
				const gchar* _tmp8_;
				_tmp7_ = stderr;
				_tmp8_ = archive_error_string (aw);
				fprintf (_tmp7_, "%s", _tmp8_);
				result = r;
				buffer = (g_free (buffer), NULL);
				return result;
			}
		}
	}
}

gchar*
proton_plus_utils_filesystem_convert_bytes_to_string (gint64 size)
{
	gchar* _tmp0_;
	gchar* result;
	_tmp0_ = g_format_size_full ((guint64) size, G_FORMAT_SIZE_DEFAULT);
	result = _tmp0_;
	return result;
}

static void
proton_plus_utils_filesystem_make_symlink_data_free (gpointer _data)
{
	ProtonPlusUtilsFilesystemMakeSymlinkData* _data_;
	_data_ = _data;
	_g_free0 (_data_->link_location);
	_g_free0 (_data_->target_path);
	g_slice_free (ProtonPlusUtilsFilesystemMakeSymlinkData, _data_);
}

void
proton_plus_utils_filesystem_make_symlink (const gchar* link_location,
                                           const gchar* target_path,
                                           GAsyncReadyCallback _callback_,
                                           gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemMakeSymlinkData* _data_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (link_location != NULL);
	g_return_if_fail (target_path != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsFilesystemMakeSymlinkData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_filesystem_make_symlink_data_free);
	_tmp0_ = g_strdup (link_location);
	_g_free0 (_data_->link_location);
	_data_->link_location = _tmp0_;
	_tmp1_ = g_strdup (target_path);
	_g_free0 (_data_->target_path);
	_data_->target_path = _tmp1_;
	proton_plus_utils_filesystem_make_symlink_co (_data_);
}

gboolean
proton_plus_utils_filesystem_make_symlink_finish (GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsFilesystemMakeSymlinkData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_filesystem_make_symlink_ready (GObject* source_object,
                                                 GAsyncResult* _res_,
                                                 gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemMakeSymlinkData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_filesystem_make_symlink_co (_data_);
}

static gboolean
proton_plus_utils_filesystem_make_symlink_co (ProtonPlusUtilsFilesystemMakeSymlinkData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_file_new_for_path (_data_->link_location);
	_data_->link_file = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->link_file;
	if (g_file_query_exists (_data_->_tmp1_, NULL)) {
		if (!g_file_test (_data_->link_location, G_FILE_TEST_IS_SYMLINK)) {
			_data_->result = FALSE;
			_g_object_unref0 (_data_->link_file);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->link_deleted = proton_plus_utils_filesystem_delete_file (_data_->link_location);
		if (!_data_->link_deleted) {
			_data_->result = FALSE;
			_g_object_unref0 (_data_->link_file);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	{
		_data_->_tmp2_ = _data_->link_file;
		_data_->_state_ = 1;
		g_file_make_symbolic_link_async (_data_->_tmp2_, _data_->target_path, G_PRIORITY_DEFAULT, NULL, proton_plus_utils_filesystem_make_symlink_ready, _data_);
		return FALSE;
		_state_1:
		_data_->link_created = g_file_make_symbolic_link_finish (_data_->_tmp2_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		if (!_data_->link_created) {
			_data_->result = FALSE;
			_g_object_unref0 (_data_->link_file);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_data_->_inner_error0_);
		_data_->result = FALSE;
		_g_object_unref0 (_data_->link_file);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->link_file);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = TRUE;
	_g_object_unref0 (_data_->link_file);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

gchar*
proton_plus_utils_filesystem_get_file_content (const gchar* path,
                                               gboolean use_uri)
{
	gchar* output = NULL;
	gchar* _tmp0_;
	GError* _inner_error0_ = NULL;
	gchar* result;
	g_return_val_if_fail (path != NULL, NULL);
	_tmp0_ = g_strdup ("");
	output = _tmp0_;
	{
		GFile* file = NULL;
		guint8* contents = NULL;
		gint contents_length1 = 0;
		gint _contents_size_ = 0;
		gchar* etag_out = NULL;
		GFile* _tmp3_;
		guint8* _tmp4_ = NULL;
		gsize _tmp5_ = 0;
		gchar* _tmp6_ = NULL;
		gchar* _tmp7_;
		if (use_uri) {
			GFile* _tmp1_;
			_tmp1_ = g_file_new_for_uri (path);
			_g_object_unref0 (file);
			file = _tmp1_;
		} else {
			GFile* _tmp2_;
			_tmp2_ = g_file_new_for_path (path);
			_g_object_unref0 (file);
			file = _tmp2_;
		}
		_tmp3_ = file;
		g_file_load_contents (_tmp3_, NULL, &_tmp4_, &_tmp5_, &_tmp6_, &_inner_error0_);
		contents = (g_free (contents), NULL);
		contents = _tmp4_;
		contents_length1 = _tmp5_;
		_contents_size_ = contents_length1;
		_g_free0 (etag_out);
		etag_out = _tmp6_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_free0 (etag_out);
			contents = (g_free (contents), NULL);
			_g_object_unref0 (file);
			goto __catch0_g_error;
		}
		_tmp7_ = g_strdup ((const gchar*) contents);
		_g_free0 (output);
		output = _tmp7_;
		_g_free0 (etag_out);
		contents = (g_free (contents), NULL);
		_g_object_unref0 (file);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp8_;
		const gchar* _tmp9_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp8_ = e;
		_tmp9_ = _tmp8_->message;
		g_warning ("filesystem.vala:157: %s", _tmp9_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_free0 (output);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = output;
	return result;
}

gboolean
proton_plus_utils_filesystem_modify_file (const gchar* path,
                                          const gchar* content)
{
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (path != NULL, FALSE);
	g_return_val_if_fail (content != NULL, FALSE);
	{
		g_file_set_contents (path, content, (gssize) -1, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			gboolean _tmp0_ = FALSE;
			if (_inner_error0_->domain == G_FILE_ERROR) {
				goto __catch0_g_file_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return _tmp0_;
		}
	}
	goto __finally0;
	__catch0_g_file_error:
	{
		GError* e = NULL;
		GError* _tmp1_;
		const gchar* _tmp2_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp1_ = e;
		_tmp2_ = _tmp1_->message;
		g_warning ("filesystem.vala:167: %s", _tmp2_);
		result = FALSE;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp3_ = FALSE;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp3_;
	}
	_tmp4_ = proton_plus_utils_filesystem_get_file_content (path, FALSE);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strcmp0 (_tmp5_, content) == 0;
	_g_free0 (_tmp5_);
	result = _tmp6_;
	return result;
}

gboolean
proton_plus_utils_filesystem_copy_symlink (const gchar* src_path,
                                           const gchar* dest_path)
{
	gboolean _tmp5_ = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (src_path != NULL, FALSE);
	g_return_val_if_fail (dest_path != NULL, FALSE);
	{
		GFile* src = NULL;
		GFile* _tmp0_;
		GFile* dest = NULL;
		GFile* _tmp1_;
		gboolean _tmp2_ = FALSE;
		_tmp0_ = g_file_new_for_path (src_path);
		src = _tmp0_;
		_tmp1_ = g_file_new_for_path (dest_path);
		dest = _tmp1_;
		_tmp2_ = g_file_copy (src, dest, G_FILE_COPY_NOFOLLOW_SYMLINKS, NULL, NULL, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (dest);
			_g_object_unref0 (src);
			goto __catch0_g_error;
		}
		result = _tmp2_;
		_g_object_unref0 (dest);
		_g_object_unref0 (src);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		const gchar* _tmp4_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp3_ = e;
		_tmp4_ = _tmp3_->message;
		g_warning ("filesystem.vala:182: %s", _tmp4_);
		result = FALSE;
		_g_error_free0 (e);
		return result;
	}
	__finally0:
	g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
	g_clear_error (&_inner_error0_);
	return _tmp5_;
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

void
proton_plus_utils_filesystem_create_file (const gchar* path,
                                          const gchar* content,
                                          gboolean private_mode)
{
	GError* _inner_error0_ = NULL;
	g_return_if_fail (path != NULL);
	{
		GFile* file = NULL;
		GFile* _tmp0_;
		GFileCreateFlags _tmp1_ = 0U;
		GFileOutputStream* os = NULL;
		GFile* _tmp2_;
		GFileOutputStream* _tmp3_;
		_tmp0_ = g_file_parse_name (path);
		file = _tmp0_;
		if (private_mode) {
			_tmp1_ = G_FILE_CREATE_PRIVATE;
		} else {
			_tmp1_ = G_FILE_CREATE_NONE;
		}
		_tmp2_ = file;
		_tmp3_ = g_file_create (_tmp2_, _tmp1_, NULL, &_inner_error0_);
		os = _tmp3_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			_g_object_unref0 (file);
			goto __catch0_g_error;
		}
		if (content != NULL) {
			GFileOutputStream* _tmp4_;
			guint8* _tmp5_;
			gint _tmp5__length1;
			gint _tmp6_ = 0;
			guint8* _tmp7_;
			gint _tmp7__length1;
			_tmp4_ = os;
			_tmp5_ = string_get_data (content, &_tmp6_);
			_tmp5__length1 = _tmp6_;
			_tmp7_ = _tmp5_;
			_tmp7__length1 = _tmp5__length1;
			g_output_stream_write ((GOutputStream*) _tmp4_, _tmp7_, (gsize) _tmp7__length1, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				_g_object_unref0 (os);
				_g_object_unref0 (file);
				goto __catch0_g_error;
			}
		}
		_g_object_unref0 (os);
		_g_object_unref0 (file);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp8_;
		const gchar* _tmp9_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp8_ = e;
		_tmp9_ = _tmp8_->message;
		g_warning ("filesystem.vala:196: %s", _tmp9_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
}

static gboolean
proton_plus_utils_filesystem_delete_file_direct (const gchar* path)
{
	gboolean result;
	g_return_val_if_fail (path != NULL, FALSE);
	if (unlink (path) != 0) {
		result = FALSE;
		return result;
	}
	result = TRUE;
	return result;
}

gboolean
proton_plus_utils_filesystem_delete_file (const gchar* path)
{
	gboolean result;
	g_return_val_if_fail (path != NULL, FALSE);
	result = proton_plus_utils_filesystem_delete_file_direct (path);
	return result;
}

static void
proton_plus_utils_filesystem_move_file_data_free (gpointer _data)
{
	ProtonPlusUtilsFilesystemMoveFileData* _data_;
	_data_ = _data;
	_g_free0 (_data_->source);
	_g_free0 (_data_->destination);
	g_slice_free (ProtonPlusUtilsFilesystemMoveFileData, _data_);
}

void
proton_plus_utils_filesystem_move_file (const gchar* source,
                                        const gchar* destination,
                                        GAsyncReadyCallback _callback_,
                                        gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemMoveFileData* _data_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (source != NULL);
	g_return_if_fail (destination != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsFilesystemMoveFileData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_filesystem_move_file_data_free);
	_tmp0_ = g_strdup (source);
	_g_free0 (_data_->source);
	_data_->source = _tmp0_;
	_tmp1_ = g_strdup (destination);
	_g_free0 (_data_->destination);
	_data_->destination = _tmp1_;
	proton_plus_utils_filesystem_move_file_co (_data_);
}

gboolean
proton_plus_utils_filesystem_move_file_finish (GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsFilesystemMoveFileData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_filesystem_move_file_ready (GObject* source_object,
                                              GAsyncResult* _res_,
                                              gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemMoveFileData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_filesystem_move_file_co (_data_);
}

static gboolean
proton_plus_utils_filesystem_move_file_co (ProtonPlusUtilsFilesystemMoveFileData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (g_strcmp0 (_data_->source, _data_->destination) == 0) {
		_data_->result = TRUE;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp0_ = g_file_parse_name (_data_->source);
		_data_->source_file = _data_->_tmp0_;
		_data_->_tmp1_ = g_file_parse_name (_data_->destination);
		_data_->destination_file = _data_->_tmp1_;
		_data_->_tmp3_ = _data_->source_file;
		_data_->_tmp4_ = _data_->destination_file;
		_data_->_state_ = 1;
		g_file_move_async (_data_->_tmp3_, _data_->_tmp4_, G_FILE_COPY_NONE, G_PRIORITY_DEFAULT, NULL, NULL, NULL, proton_plus_utils_filesystem_move_file_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = g_file_move_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->destination_file);
			_g_object_unref0 (_data_->source_file);
			goto __catch0_g_error;
		}
		_data_->result = _data_->_tmp2_;
		_g_object_unref0 (_data_->destination_file);
		_g_object_unref0 (_data_->source_file);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp5_ = _data_->e;
		_data_->_tmp6_ = _data_->_tmp5_->message;
		g_warning ("filesystem.vala:220: %s", _data_->_tmp6_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = FALSE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
proton_plus_utils_filesystem_move_directory_data_free (gpointer _data)
{
	ProtonPlusUtilsFilesystemMoveDirectoryData* _data_;
	_data_ = _data;
	_g_free0 (_data_->source);
	_g_free0 (_data_->destination);
	g_slice_free (ProtonPlusUtilsFilesystemMoveDirectoryData, _data_);
}

void
proton_plus_utils_filesystem_move_directory (const gchar* source,
                                             const gchar* destination,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemMoveDirectoryData* _data_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (source != NULL);
	g_return_if_fail (destination != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsFilesystemMoveDirectoryData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_filesystem_move_directory_data_free);
	_tmp0_ = g_strdup (source);
	_g_free0 (_data_->source);
	_data_->source = _tmp0_;
	_tmp1_ = g_strdup (destination);
	_g_free0 (_data_->destination);
	_data_->destination = _tmp1_;
	proton_plus_utils_filesystem_move_directory_co (_data_);
}

gboolean
proton_plus_utils_filesystem_move_directory_finish (GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsFilesystemMoveDirectoryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_filesystem_move_directory_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemMoveDirectoryData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_filesystem_move_directory_co (_data_);
}

static gboolean
proton_plus_utils_filesystem_move_directory_co (ProtonPlusUtilsFilesystemMoveDirectoryData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	proton_plus_utils_filesystem_copy_directory (_data_->source, _data_->destination, proton_plus_utils_filesystem_move_directory_ready, _data_);
	return FALSE;
	_state_1:
	_data_->copied = proton_plus_utils_filesystem_copy_directory_finish (_data_->_res_);
	if (!_data_->copied) {
		if (g_file_test (_data_->destination, G_FILE_TEST_IS_DIR)) {
			_data_->_state_ = 2;
			proton_plus_utils_filesystem_delete_directory (_data_->destination, proton_plus_utils_filesystem_move_directory_ready, _data_);
			return FALSE;
			_state_2:
			proton_plus_utils_filesystem_delete_directory_finish (_data_->_res_);
		}
		_data_->result = FALSE;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_state_ = 3;
	proton_plus_utils_filesystem_delete_directory (_data_->source, proton_plus_utils_filesystem_move_directory_ready, _data_);
	return FALSE;
	_state_3:
	proton_plus_utils_filesystem_delete_directory_finish (_data_->_res_);
	_data_->result = TRUE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
proton_plus_utils_filesystem_copy_directory_data_free (gpointer _data)
{
	ProtonPlusUtilsFilesystemCopyDirectoryData* _data_;
	_data_ = _data;
	_g_free0 (_data_->source);
	_g_free0 (_data_->destination);
	g_slice_free (ProtonPlusUtilsFilesystemCopyDirectoryData, _data_);
}

void
proton_plus_utils_filesystem_copy_directory (const gchar* source,
                                             const gchar* destination,
                                             GAsyncReadyCallback _callback_,
                                             gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemCopyDirectoryData* _data_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (source != NULL);
	g_return_if_fail (destination != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsFilesystemCopyDirectoryData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_filesystem_copy_directory_data_free);
	_tmp0_ = g_strdup (source);
	_g_free0 (_data_->source);
	_data_->source = _tmp0_;
	_tmp1_ = g_strdup (destination);
	_g_free0 (_data_->destination);
	_data_->destination = _tmp1_;
	proton_plus_utils_filesystem_copy_directory_co (_data_);
}

gboolean
proton_plus_utils_filesystem_copy_directory_finish (GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsFilesystemCopyDirectoryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
proton_plus_utils_filesystem_copy_directory_ready (GObject* source_object,
                                                   GAsyncResult* _res_,
                                                   gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemCopyDirectoryData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	proton_plus_utils_filesystem_copy_directory_co (_data_);
}

static gboolean
proton_plus_utils_filesystem_copy_directory_co (ProtonPlusUtilsFilesystemCopyDirectoryData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->_tmp0_ = g_file_parse_name (_data_->source);
		_data_->src = _data_->_tmp0_;
		_data_->_tmp1_ = g_file_parse_name (_data_->destination);
		_data_->dest = _data_->_tmp1_;
		_data_->_tmp2_ = _data_->src;
		if (!g_file_query_exists (_data_->_tmp2_, NULL)) {
			_data_->_tmp3_ = stderr;
			fprintf (_data_->_tmp3_, "Source directory does not exist\n");
			_data_->result = FALSE;
			_g_object_unref0 (_data_->dest);
			_g_object_unref0 (_data_->src);
			g_task_return_pointer (_data_->_async_result, _data_, NULL);
			if (_data_->_state_ != 0) {
				while (!g_task_get_completed (_data_->_async_result)) {
					g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
				}
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->_tmp4_ = _data_->dest;
		if (!g_file_query_exists (_data_->_tmp4_, NULL)) {
			_data_->_tmp5_ = _data_->dest;
			_data_->_state_ = 1;
			g_file_make_directory_async (_data_->_tmp5_, G_PRIORITY_DEFAULT, NULL, proton_plus_utils_filesystem_copy_directory_ready, _data_);
			return FALSE;
			_state_1:
			g_file_make_directory_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->dest);
				_g_object_unref0 (_data_->src);
				goto __catch0_g_error;
			}
		}
		_data_->_tmp6_ = _data_->src;
		_data_->_state_ = 2;
		g_file_enumerate_children_async (_data_->_tmp6_, "standard::*", G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, proton_plus_utils_filesystem_copy_directory_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp7_ = g_file_enumerate_children_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error0_);
		_data_->enumerator = _data_->_tmp7_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			_g_object_unref0 (_data_->dest);
			_g_object_unref0 (_data_->src);
			goto __catch0_g_error;
		}
		while (TRUE) {
			_data_->_tmp9_ = _data_->enumerator;
			_data_->_tmp10_ = g_file_enumerator_next_file (_data_->_tmp9_, NULL, &_data_->_inner_error0_);
			_data_->_tmp8_ = _data_->_tmp10_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->file_info);
				_g_object_unref0 (_data_->enumerator);
				_g_object_unref0 (_data_->dest);
				_g_object_unref0 (_data_->src);
				goto __catch0_g_error;
			}
			_data_->_tmp11_ = _data_->_tmp8_;
			_data_->_tmp8_ = NULL;
			_g_object_unref0 (_data_->file_info);
			_data_->file_info = _data_->_tmp11_;
			_data_->_tmp12_ = _data_->file_info;
			if (!(_data_->_tmp12_ != NULL)) {
				_g_object_unref0 (_data_->_tmp8_);
				break;
			}
			_data_->_tmp13_ = _data_->file_info;
			_data_->_tmp14_ = g_file_info_get_name (_data_->_tmp13_);
			_data_->_tmp15_ = g_strdup (_data_->_tmp14_);
			_data_->file_name = _data_->_tmp15_;
			_data_->_tmp16_ = _data_->src;
			_data_->_tmp17_ = _data_->file_name;
			_data_->_tmp18_ = g_file_get_child (_data_->_tmp16_, _data_->_tmp17_);
			_data_->src_file = _data_->_tmp18_;
			_data_->_tmp19_ = _data_->dest;
			_data_->_tmp20_ = _data_->file_name;
			_data_->_tmp21_ = g_file_get_child (_data_->_tmp19_, _data_->_tmp20_);
			_data_->dest_file = _data_->_tmp21_;
			_data_->_tmp22_ = _data_->file_info;
			if (g_file_info_get_file_type (_data_->_tmp22_) == G_FILE_TYPE_DIRECTORY) {
				_data_->_tmp23_ = _data_->src_file;
				_data_->_tmp24_ = g_file_get_path (_data_->_tmp23_);
				_data_->_tmp25_ = _data_->_tmp24_;
				_data_->_tmp26_ = _data_->dest_file;
				_data_->_tmp27_ = g_file_get_path (_data_->_tmp26_);
				_data_->_tmp28_ = _data_->_tmp27_;
				_data_->_state_ = 3;
				proton_plus_utils_filesystem_copy_directory (_data_->_tmp25_, _data_->_tmp28_, proton_plus_utils_filesystem_copy_directory_ready, _data_);
				return FALSE;
				_state_3:
				proton_plus_utils_filesystem_copy_directory_finish (_data_->_res_);
				_g_free0 (_data_->_tmp28_);
				_g_free0 (_data_->_tmp25_);
			} else {
				{
					_data_->_tmp29_ = _data_->src_file;
					_data_->_tmp30_ = _data_->dest_file;
					_data_->_state_ = 4;
					g_file_copy_async (_data_->_tmp29_, _data_->_tmp30_, G_FILE_COPY_NOFOLLOW_SYMLINKS, G_PRIORITY_DEFAULT, NULL, NULL, NULL, proton_plus_utils_filesystem_copy_directory_ready, _data_);
					return FALSE;
					_state_4:
					g_file_copy_finish (_data_->_tmp29_, _data_->_res_, &_data_->_inner_error0_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						goto __catch1_g_error;
					}
				}
				goto __finally1;
				__catch1_g_error:
				{
					_data_->e = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp31_ = _data_->file_name;
					_data_->_tmp32_ = _data_->e;
					_data_->_tmp33_ = _data_->_tmp32_->message;
					g_warning ("filesystem.vala:276: Failed to copy %s: %s\n", _data_->_tmp31_, _data_->_tmp33_);
					_data_->result = FALSE;
					_g_error_free0 (_data_->e);
					_g_object_unref0 (_data_->dest_file);
					_g_object_unref0 (_data_->src_file);
					_g_free0 (_data_->file_name);
					_g_object_unref0 (_data_->_tmp8_);
					_g_object_unref0 (_data_->file_info);
					_g_object_unref0 (_data_->enumerator);
					_g_object_unref0 (_data_->dest);
					_g_object_unref0 (_data_->src);
					g_task_return_pointer (_data_->_async_result, _data_, NULL);
					if (_data_->_state_ != 0) {
						while (!g_task_get_completed (_data_->_async_result)) {
							g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
						}
					}
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				__finally1:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_g_object_unref0 (_data_->dest_file);
					_g_object_unref0 (_data_->src_file);
					_g_free0 (_data_->file_name);
					_g_object_unref0 (_data_->_tmp8_);
					_g_object_unref0 (_data_->file_info);
					_g_object_unref0 (_data_->enumerator);
					_g_object_unref0 (_data_->dest);
					_g_object_unref0 (_data_->src);
					goto __catch0_g_error;
				}
			}
			_g_object_unref0 (_data_->dest_file);
			_g_object_unref0 (_data_->src_file);
			_g_free0 (_data_->file_name);
			_g_object_unref0 (_data_->_tmp8_);
		}
		_g_object_unref0 (_data_->file_info);
		_g_object_unref0 (_data_->enumerator);
		_g_object_unref0 (_data_->dest);
		_g_object_unref0 (_data_->src);
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->_vala1_e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp34_ = _data_->_vala1_e;
		_data_->_tmp35_ = _data_->_tmp34_->message;
		g_warning ("filesystem.vala:282: %s", _data_->_tmp35_);
		_data_->result = FALSE;
		_g_error_free0 (_data_->_vala1_e);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->result = TRUE;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
proton_plus_utils_filesystem_move_dir_contents_data_free (gpointer _data)
{
	ProtonPlusUtilsFilesystemMoveDirContentsData* _data_;
	_data_ = _data;
	g_slice_free (ProtonPlusUtilsFilesystemMoveDirContentsData, _data_);
}

void
proton_plus_utils_filesystem_move_dir_contents (const gchar* source_dir,
                                                const gchar* target_dir,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemMoveDirContentsData* _data_;
	gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (source_dir != NULL);
	g_return_if_fail (target_dir != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsFilesystemMoveDirContentsData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_filesystem_move_dir_contents_data_free);
	_tmp0_ = g_strdup (source_dir);
	_g_free0 (_data_->source_dir);
	_data_->source_dir = _tmp0_;
	_tmp1_ = g_strdup (target_dir);
	_g_free0 (_data_->target_dir);
	_data_->target_dir = _tmp1_;
	proton_plus_utils_filesystem_move_dir_contents_co (_data_);
}

gboolean
proton_plus_utils_filesystem_move_dir_contents_finish (GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsFilesystemMoveDirContentsData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static Block15Data*
block15_data_ref (Block15Data* _data15_)
{
	g_atomic_int_inc (&_data15_->_ref_count_);
	return _data15_;
}

static void
block15_data_unref (void * _userdata_)
{
	Block15Data* _data15_;
	_data15_ = (Block15Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data15_->_ref_count_)) {
		(_data15_->callback_target_destroy_notify == NULL) ? NULL : (_data15_->callback_target_destroy_notify (_data15_->callback_target), NULL);
		_data15_->callback = NULL;
		_data15_->callback_target = NULL;
		_data15_->callback_target_destroy_notify = NULL;
		_g_free0 (_data15_->source_dir);
		_g_free0 (_data15_->target_dir);
		g_slice_free (Block15Data, _data15_);
	}
}

static gboolean
_proton_plus_utils_filesystem_move_dir_contents_co_gsource_func (gpointer self)
{
	gboolean result;
	result = proton_plus_utils_filesystem_move_dir_contents_co (self);
	return result;
}

static void
__lambda7_ (Block15Data* _data15_)
{
	GSourceFunc _tmp14_;
	gpointer _tmp14__target;
	GDestroyNotify _tmp14__target_destroy_notify;
	GError* _inner_error0_ = NULL;
	{
		GDir* dir = NULL;
		GDir* _tmp0_;
		gchar* name = NULL;
		_tmp0_ = g_dir_open (_data15_->source_dir, (guint) 0, &_inner_error0_);
		dir = _tmp0_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		name = NULL;
		while (TRUE) {
			GDir* _tmp1_;
			const gchar* _tmp2_;
			gchar* _tmp3_;
			const gchar* _tmp4_;
			gchar* source_path = NULL;
			const gchar* _tmp5_;
			gchar* _tmp6_;
			gchar* target_path = NULL;
			const gchar* _tmp7_;
			gchar* _tmp8_;
			const gchar* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			_tmp1_ = dir;
			_tmp2_ = g_dir_read_name (_tmp1_);
			_tmp3_ = g_strdup (_tmp2_);
			_g_free0 (name);
			name = _tmp3_;
			_tmp4_ = name;
			if (!(_tmp4_ != NULL)) {
				break;
			}
			_tmp5_ = name;
			_tmp6_ = g_build_filename (_data15_->source_dir, _tmp5_, NULL);
			source_path = _tmp6_;
			_tmp7_ = name;
			_tmp8_ = g_build_filename (_data15_->target_dir, _tmp7_, NULL);
			target_path = _tmp8_;
			_tmp9_ = target_path;
			if (g_file_test (_tmp9_, G_FILE_TEST_EXISTS)) {
				_g_free0 (target_path);
				_g_free0 (source_path);
				_g_free0 (name);
				_g_dir_close0 (dir);
				return;
			}
			_tmp10_ = source_path;
			_tmp11_ = target_path;
			if (g_rename (_tmp10_, _tmp11_) != 0) {
				_g_free0 (target_path);
				_g_free0 (source_path);
				_g_free0 (name);
				_g_dir_close0 (dir);
				return;
			}
			_g_free0 (target_path);
			_g_free0 (source_path);
		}
		_data15_->output = TRUE;
		_g_free0 (name);
		_g_dir_close0 (dir);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp12_;
		const gchar* _tmp13_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp12_ = e;
		_tmp13_ = _tmp12_->message;
		g_warning ("filesystem.vala:315: %s", _tmp13_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return;
	}
	_tmp14_ = _data15_->callback;
	_tmp14__target = _data15_->callback_target;
	_tmp14__target_destroy_notify = _data15_->callback_target_destroy_notify;
	_data15_->callback = NULL;
	_data15_->callback_target = NULL;
	_data15_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT, _tmp14_, _tmp14__target, _tmp14__target_destroy_notify);
}

static gpointer
___lambda7__gthread_func (gpointer self)
{
	gpointer result;
	__lambda7_ (self);
	result = NULL;
	block15_data_unref (self);
	return result;
}

static gboolean
proton_plus_utils_filesystem_move_dir_contents_co (ProtonPlusUtilsFilesystemMoveDirContentsData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data15_ = g_slice_new0 (Block15Data);
	_data_->_data15_->_ref_count_ = 1;
	_g_free0 (_data_->_data15_->source_dir);
	_data_->_data15_->source_dir = _data_->source_dir;
	_g_free0 (_data_->_data15_->target_dir);
	_data_->_data15_->target_dir = _data_->target_dir;
	_data_->_data15_->_async_data_ = _data_;
	_data_->_data15_->callback = _proton_plus_utils_filesystem_move_dir_contents_co_gsource_func;
	_data_->_data15_->callback_target = _data_;
	_data_->_data15_->callback_target_destroy_notify = NULL;
	_data_->_data15_->output = FALSE;
	_data_->_tmp0_ = g_thread_new ("move_dir_contents", ___lambda7__gthread_func, block15_data_ref (_data_->_data15_));
	_data_->_tmp1_ = _data_->_tmp0_;
	_g_thread_unref0 (_data_->_tmp1_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->result = _data_->_data15_->output;
	block15_data_unref (_data_->_data15_);
	_data_->_data15_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static gboolean
proton_plus_utils_filesystem_delete_directory_direct (const gchar* path)
{
	DIR* dir = NULL;
	DIR* _tmp0_;
	DIR* _tmp1_;
	struct dirent* cur_d = NULL;
	struct stat stat_ = {0};
	gboolean result;
	g_return_val_if_fail (path != NULL, FALSE);
	_tmp0_ = opendir (path);
	dir = _tmp0_;
	_tmp1_ = dir;
	if (_tmp1_ == NULL) {
		result = FALSE;
		_closedir0 (dir);
		return result;
	}
	while (TRUE) {
		DIR* _tmp2_;
		struct dirent* _tmp3_;
		struct dirent* _tmp4_;
		gchar* d_name = NULL;
		struct dirent* _tmp5_;
		gchar* _tmp6_;
		gboolean _tmp7_ = FALSE;
		const gchar* _tmp8_;
		gchar* cur_path = NULL;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		const gchar* _tmp14_;
		struct stat _tmp15_ = {0};
		gint _tmp16_;
		struct stat _tmp17_;
		_tmp2_ = dir;
		_tmp3_ = readdir (_tmp2_);
		cur_d = _tmp3_;
		_tmp4_ = cur_d;
		if (!(_tmp4_ != NULL)) {
			break;
		}
		_tmp5_ = cur_d;
		_tmp6_ = g_strdup ((const gchar*) _tmp5_->d_name);
		d_name = _tmp6_;
		_tmp8_ = d_name;
		if (g_strcmp0 (_tmp8_, ".") == 0) {
			_tmp7_ = TRUE;
		} else {
			const gchar* _tmp9_;
			_tmp9_ = d_name;
			_tmp7_ = g_strcmp0 (_tmp9_, "..") == 0;
		}
		if (_tmp7_) {
			_g_free0 (d_name);
			continue;
		}
		_tmp10_ = string_to_string (path);
		_tmp11_ = d_name;
		_tmp12_ = string_to_string (_tmp11_);
		_tmp13_ = g_strconcat (_tmp10_, "/", _tmp12_, NULL);
		cur_path = _tmp13_;
		_tmp14_ = cur_path;
		_tmp16_ = lstat (_tmp14_, &_tmp15_);
		stat_ = _tmp15_;
		if (_tmp16_ != 0) {
			result = FALSE;
			_g_free0 (cur_path);
			_g_free0 (d_name);
			_closedir0 (dir);
			return result;
		}
		_tmp17_ = stat_;
		if (S_ISDIR (_tmp17_.st_mode)) {
			const gchar* _tmp18_;
			const gchar* _tmp19_;
			_tmp18_ = cur_path;
			if (!proton_plus_utils_filesystem_delete_directory_direct (_tmp18_)) {
				result = FALSE;
				_g_free0 (cur_path);
				_g_free0 (d_name);
				_closedir0 (dir);
				return result;
			}
			_tmp19_ = cur_path;
			if (rmdir (_tmp19_) != 0) {
				result = FALSE;
				_g_free0 (cur_path);
				_g_free0 (d_name);
				_closedir0 (dir);
				return result;
			}
		} else {
			const gchar* _tmp20_;
			_tmp20_ = cur_path;
			if (!proton_plus_utils_filesystem_delete_file_direct (_tmp20_)) {
				result = FALSE;
				_g_free0 (cur_path);
				_g_free0 (d_name);
				_closedir0 (dir);
				return result;
			}
		}
		_g_free0 (cur_path);
		_g_free0 (d_name);
	}
	result = TRUE;
	_closedir0 (dir);
	return result;
}

static void
proton_plus_utils_filesystem_delete_directory_data_free (gpointer _data)
{
	ProtonPlusUtilsFilesystemDeleteDirectoryData* _data_;
	_data_ = _data;
	g_slice_free (ProtonPlusUtilsFilesystemDeleteDirectoryData, _data_);
}

void
proton_plus_utils_filesystem_delete_directory (const gchar* path,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemDeleteDirectoryData* _data_;
	gchar* _tmp0_;
	g_return_if_fail (path != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsFilesystemDeleteDirectoryData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_filesystem_delete_directory_data_free);
	_tmp0_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp0_;
	proton_plus_utils_filesystem_delete_directory_co (_data_);
}

gboolean
proton_plus_utils_filesystem_delete_directory_finish (GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsFilesystemDeleteDirectoryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static Block16Data*
block16_data_ref (Block16Data* _data16_)
{
	g_atomic_int_inc (&_data16_->_ref_count_);
	return _data16_;
}

static void
block16_data_unref (void * _userdata_)
{
	Block16Data* _data16_;
	_data16_ = (Block16Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data16_->_ref_count_)) {
		(_data16_->callback_target_destroy_notify == NULL) ? NULL : (_data16_->callback_target_destroy_notify (_data16_->callback_target), NULL);
		_data16_->callback = NULL;
		_data16_->callback_target = NULL;
		_data16_->callback_target_destroy_notify = NULL;
		_g_free0 (_data16_->path);
		g_slice_free (Block16Data, _data16_);
	}
}

static gboolean
_proton_plus_utils_filesystem_delete_directory_co_gsource_func (gpointer self)
{
	gboolean result;
	result = proton_plus_utils_filesystem_delete_directory_co (self);
	return result;
}

static void
__lambda5_ (Block16Data* _data16_)
{
	GSourceFunc _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	if (proton_plus_utils_filesystem_delete_directory_direct (_data16_->path)) {
		if (rmdir (_data16_->path) == 0) {
			_data16_->output = TRUE;
		}
	}
	_tmp0_ = _data16_->callback;
	_tmp0__target = _data16_->callback_target;
	_tmp0__target_destroy_notify = _data16_->callback_target_destroy_notify;
	_data16_->callback = NULL;
	_data16_->callback_target = NULL;
	_data16_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT, _tmp0_, _tmp0__target, _tmp0__target_destroy_notify);
}

static gpointer
___lambda5__gthread_func (gpointer self)
{
	gpointer result;
	__lambda5_ (self);
	result = NULL;
	block16_data_unref (self);
	return result;
}

static gboolean
proton_plus_utils_filesystem_delete_directory_co (ProtonPlusUtilsFilesystemDeleteDirectoryData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data16_ = g_slice_new0 (Block16Data);
	_data_->_data16_->_ref_count_ = 1;
	_g_free0 (_data_->_data16_->path);
	_data_->_data16_->path = _data_->path;
	_data_->_data16_->_async_data_ = _data_;
	_data_->_data16_->callback = _proton_plus_utils_filesystem_delete_directory_co_gsource_func;
	_data_->_data16_->callback_target = _data_;
	_data_->_data16_->callback_target_destroy_notify = NULL;
	_data_->_data16_->output = FALSE;
	_data_->_tmp0_ = g_thread_new ("delete_directory", ___lambda5__gthread_func, block16_data_ref (_data_->_data16_));
	_data_->_tmp1_ = _data_->_tmp0_;
	_g_thread_unref0 (_data_->_tmp1_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->result = _data_->_data16_->output;
	block16_data_unref (_data_->_data16_);
	_data_->_data16_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
proton_plus_utils_filesystem_create_directory_data_free (gpointer _data)
{
	ProtonPlusUtilsFilesystemCreateDirectoryData* _data_;
	_data_ = _data;
	g_slice_free (ProtonPlusUtilsFilesystemCreateDirectoryData, _data_);
}

void
proton_plus_utils_filesystem_create_directory (const gchar* path,
                                               GAsyncReadyCallback _callback_,
                                               gpointer _user_data_)
{
	ProtonPlusUtilsFilesystemCreateDirectoryData* _data_;
	gchar* _tmp0_;
	g_return_if_fail (path != NULL);
	_data_ = g_slice_new0 (ProtonPlusUtilsFilesystemCreateDirectoryData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, proton_plus_utils_filesystem_create_directory_data_free);
	_tmp0_ = g_strdup (path);
	_g_free0 (_data_->path);
	_data_->path = _tmp0_;
	proton_plus_utils_filesystem_create_directory_co (_data_);
}

gboolean
proton_plus_utils_filesystem_create_directory_finish (GAsyncResult* _res_)
{
	gboolean result;
	ProtonPlusUtilsFilesystemCreateDirectoryData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static Block17Data*
block17_data_ref (Block17Data* _data17_)
{
	g_atomic_int_inc (&_data17_->_ref_count_);
	return _data17_;
}

static void
block17_data_unref (void * _userdata_)
{
	Block17Data* _data17_;
	_data17_ = (Block17Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data17_->_ref_count_)) {
		(_data17_->callback_target_destroy_notify == NULL) ? NULL : (_data17_->callback_target_destroy_notify (_data17_->callback_target), NULL);
		_data17_->callback = NULL;
		_data17_->callback_target = NULL;
		_data17_->callback_target_destroy_notify = NULL;
		_g_free0 (_data17_->path);
		g_slice_free (Block17Data, _data17_);
	}
}

static gboolean
_proton_plus_utils_filesystem_create_directory_co_gsource_func (gpointer self)
{
	gboolean result;
	result = proton_plus_utils_filesystem_create_directory_co (self);
	return result;
}

static gint
string_index_of_char (const gchar* self,
                      gunichar c,
                      gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = g_utf8_strchr (((gchar*) self) + start_index, (gssize) -1, c);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static void
__lambda8_ (Block17Data* _data17_)
{
	gboolean has_leading_slash = FALSE;
	gchar** parts = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint parts_length1;
	gint _parts_size_;
	struct stat stat_ = {0};
	gchar* current_path = NULL;
	gchar* _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	GSourceFunc _tmp21_;
	gpointer _tmp21__target;
	GDestroyNotify _tmp21__target_destroy_notify;
	has_leading_slash = string_index_of_char (_data17_->path, (gunichar) '/', 0) == 0;
	_tmp1_ = _tmp0_ = g_strsplit (_data17_->path, "/", 0);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = parts_length1;
	_tmp2_ = g_strdup ("");
	current_path = _tmp2_;
	_tmp3_ = parts;
	_tmp3__length1 = parts_length1;
	{
		gchar** p_collection = NULL;
		gint p_collection_length1 = 0;
		gint _p_collection_size_ = 0;
		gint p_it = 0;
		p_collection = _tmp3_;
		p_collection_length1 = _tmp3__length1;
		for (p_it = 0; p_it < p_collection_length1; p_it = p_it + 1) {
			gchar* _tmp4_;
			gchar* p = NULL;
			_tmp4_ = g_strdup (p_collection[p_it]);
			p = _tmp4_;
			{
				const gchar* _tmp5_;
				gboolean _tmp6_ = FALSE;
				const gchar* _tmp7_;
				const gchar* _tmp16_;
				_tmp5_ = p;
				if (g_strcmp0 (_tmp5_, "") == 0) {
					_g_free0 (p);
					continue;
				}
				_tmp7_ = current_path;
				if (g_strcmp0 (_tmp7_, "") == 0) {
					_tmp6_ = !has_leading_slash;
				} else {
					_tmp6_ = FALSE;
				}
				if (_tmp6_) {
					const gchar* _tmp8_;
					gchar* _tmp9_;
					_tmp8_ = p;
					_tmp9_ = g_strdup (_tmp8_);
					_g_free0 (current_path);
					current_path = _tmp9_;
				} else {
					const gchar* _tmp10_;
					const gchar* _tmp11_;
					const gchar* _tmp12_;
					gchar* _tmp13_;
					gchar* _tmp14_;
					gchar* _tmp15_;
					_tmp10_ = current_path;
					_tmp11_ = p;
					_tmp12_ = string_to_string (_tmp11_);
					_tmp13_ = g_strconcat ("/", _tmp12_, NULL);
					_tmp14_ = _tmp13_;
					_tmp15_ = g_strconcat (_tmp10_, _tmp14_, NULL);
					_g_free0 (current_path);
					current_path = _tmp15_;
					_g_free0 (_tmp14_);
				}
				_tmp16_ = current_path;
				if (mkdir (_tmp16_, PROTON_PLUS_UTILS_FILESYSTEM_S_IRWXUGO) != 0) {
					const gchar* _tmp17_;
					struct stat _tmp18_ = {0};
					gint _tmp19_;
					struct stat _tmp20_;
					if (errno != EEXIST) {
						_g_free0 (p);
						_g_free0 (current_path);
						parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
						return;
					}
					_tmp17_ = current_path;
					_tmp19_ = stat (_tmp17_, &_tmp18_);
					stat_ = _tmp18_;
					if (_tmp19_ != 0) {
						_g_free0 (p);
						_g_free0 (current_path);
						parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
						return;
					}
					_tmp20_ = stat_;
					if (!S_ISDIR (_tmp20_.st_mode)) {
						_g_free0 (p);
						_g_free0 (current_path);
						parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
						return;
					}
				}
				_data17_->output = TRUE;
				_g_free0 (p);
			}
		}
	}
	_tmp21_ = _data17_->callback;
	_tmp21__target = _data17_->callback_target;
	_tmp21__target_destroy_notify = _data17_->callback_target_destroy_notify;
	_data17_->callback = NULL;
	_data17_->callback_target = NULL;
	_data17_->callback_target_destroy_notify = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT, _tmp21_, _tmp21__target, _tmp21__target_destroy_notify);
	_g_free0 (current_path);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
}

static gpointer
___lambda8__gthread_func (gpointer self)
{
	gpointer result;
	__lambda8_ (self);
	result = NULL;
	block17_data_unref (self);
	return result;
}

static gboolean
proton_plus_utils_filesystem_create_directory_co (ProtonPlusUtilsFilesystemCreateDirectoryData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data17_ = g_slice_new0 (Block17Data);
	_data_->_data17_->_ref_count_ = 1;
	_g_free0 (_data_->_data17_->path);
	_data_->_data17_->path = _data_->path;
	_data_->_data17_->_async_data_ = _data_;
	_data_->_data17_->callback = _proton_plus_utils_filesystem_create_directory_co_gsource_func;
	_data_->_data17_->callback_target = _data_;
	_data_->_data17_->callback_target_destroy_notify = NULL;
	_data_->_data17_->output = FALSE;
	_data_->_tmp0_ = g_thread_new ("create_directory", ___lambda8__gthread_func, block17_data_ref (_data_->_data17_));
	_data_->_tmp1_ = _data_->_tmp0_;
	_g_thread_unref0 (_data_->_tmp1_);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->result = _data_->_data17_->output;
	block17_data_unref (_data_->_data17_);
	_data_->_data17_ = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

guint64
proton_plus_utils_filesystem_get_directory_size (const gchar* path)
{
	guint64 size = 0ULL;
	DIR* dir = NULL;
	DIR* _tmp0_;
	DIR* _tmp1_;
	struct dirent* cur_d = NULL;
	struct stat stat_ = {0};
	guint64 result;
	g_return_val_if_fail (path != NULL, 0ULL);
	size = (guint64) 0;
	_tmp0_ = opendir (path);
	dir = _tmp0_;
	_tmp1_ = dir;
	if (_tmp1_ == NULL) {
		result = (guint64) 0;
		_closedir0 (dir);
		return result;
	}
	while (TRUE) {
		DIR* _tmp2_;
		struct dirent* _tmp3_;
		struct dirent* _tmp4_;
		gchar* d_name = NULL;
		struct dirent* _tmp5_;
		gchar* _tmp6_;
		gboolean _tmp7_ = FALSE;
		const gchar* _tmp8_;
		gchar* cur_path = NULL;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		const gchar* _tmp12_;
		gchar* _tmp13_;
		const gchar* _tmp14_;
		struct stat _tmp15_ = {0};
		gint _tmp16_;
		struct stat _tmp17_;
		_tmp2_ = dir;
		_tmp3_ = readdir (_tmp2_);
		cur_d = _tmp3_;
		_tmp4_ = cur_d;
		if (!(_tmp4_ != NULL)) {
			break;
		}
		_tmp5_ = cur_d;
		_tmp6_ = g_strdup ((const gchar*) _tmp5_->d_name);
		d_name = _tmp6_;
		_tmp8_ = d_name;
		if (g_strcmp0 (_tmp8_, ".") == 0) {
			_tmp7_ = TRUE;
		} else {
			const gchar* _tmp9_;
			_tmp9_ = d_name;
			_tmp7_ = g_strcmp0 (_tmp9_, "..") == 0;
		}
		if (_tmp7_) {
			_g_free0 (d_name);
			continue;
		}
		_tmp10_ = string_to_string (path);
		_tmp11_ = d_name;
		_tmp12_ = string_to_string (_tmp11_);
		_tmp13_ = g_strconcat (_tmp10_, "/", _tmp12_, NULL);
		cur_path = _tmp13_;
		_tmp14_ = cur_path;
		_tmp16_ = lstat (_tmp14_, &_tmp15_);
		stat_ = _tmp15_;
		if (_tmp16_ != 0) {
			_g_free0 (cur_path);
			_g_free0 (d_name);
			continue;
		}
		_tmp17_ = stat_;
		if (S_ISDIR (_tmp17_.st_mode)) {
			const gchar* _tmp18_;
			_tmp18_ = cur_path;
			size += proton_plus_utils_filesystem_get_directory_size (_tmp18_);
		} else {
			struct stat _tmp19_;
			_tmp19_ = stat_;
			size += (guint64) _tmp19_.st_size;
		}
		_g_free0 (cur_path);
		_g_free0 (d_name);
	}
	result = size;
	_closedir0 (dir);
	return result;
}

ProtonPlusUtilsFilesystem*
proton_plus_utils_filesystem_construct (GType object_type)
{
	ProtonPlusUtilsFilesystem* self = NULL;
	self = (ProtonPlusUtilsFilesystem*) g_type_create_instance (object_type);
	return self;
}

ProtonPlusUtilsFilesystem*
proton_plus_utils_filesystem_new (void)
{
	return proton_plus_utils_filesystem_construct (PROTON_PLUS_UTILS_TYPE_FILESYSTEM);
}

static void
proton_plus_utils_value_filesystem_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
proton_plus_utils_value_filesystem_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		proton_plus_utils_filesystem_unref (value->data[0].v_pointer);
	}
}

static void
proton_plus_utils_value_filesystem_copy_value (const GValue* src_value,
                                               GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = proton_plus_utils_filesystem_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
proton_plus_utils_value_filesystem_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
proton_plus_utils_value_filesystem_collect_value (GValue* value,
                                                  guint n_collect_values,
                                                  GTypeCValue* collect_values,
                                                  guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		ProtonPlusUtilsFilesystem * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = proton_plus_utils_filesystem_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
proton_plus_utils_value_filesystem_lcopy_value (const GValue* value,
                                                guint n_collect_values,
                                                GTypeCValue* collect_values,
                                                guint collect_flags)
{
	ProtonPlusUtilsFilesystem ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = proton_plus_utils_filesystem_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
proton_plus_utils_param_spec_filesystem (const gchar* name,
                                         const gchar* nick,
                                         const gchar* blurb,
                                         GType object_type,
                                         GParamFlags flags)
{
	ProtonPlusUtilsParamSpecFilesystem* spec;
	g_return_val_if_fail (g_type_is_a (object_type, PROTON_PLUS_UTILS_TYPE_FILESYSTEM), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
proton_plus_utils_value_get_filesystem (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROTON_PLUS_UTILS_TYPE_FILESYSTEM), NULL);
	return value->data[0].v_pointer;
}

void
proton_plus_utils_value_set_filesystem (GValue* value,
                                        gpointer v_object)
{
	ProtonPlusUtilsFilesystem * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROTON_PLUS_UTILS_TYPE_FILESYSTEM));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PROTON_PLUS_UTILS_TYPE_FILESYSTEM));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		proton_plus_utils_filesystem_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		proton_plus_utils_filesystem_unref (old);
	}
}

void
proton_plus_utils_value_take_filesystem (GValue* value,
                                         gpointer v_object)
{
	ProtonPlusUtilsFilesystem * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROTON_PLUS_UTILS_TYPE_FILESYSTEM));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PROTON_PLUS_UTILS_TYPE_FILESYSTEM));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		proton_plus_utils_filesystem_unref (old);
	}
}

static void
proton_plus_utils_filesystem_class_init (ProtonPlusUtilsFilesystemClass * klass,
                                         gpointer klass_data)
{
	proton_plus_utils_filesystem_parent_class = g_type_class_peek_parent (klass);
	((ProtonPlusUtilsFilesystemClass *) klass)->finalize = proton_plus_utils_filesystem_finalize;
}

static void
proton_plus_utils_filesystem_instance_init (ProtonPlusUtilsFilesystem * self,
                                            gpointer klass)
{
	self->ref_count = 1;
}

static void
proton_plus_utils_filesystem_finalize (ProtonPlusUtilsFilesystem * obj)
{
	ProtonPlusUtilsFilesystem * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PROTON_PLUS_UTILS_TYPE_FILESYSTEM, ProtonPlusUtilsFilesystem);
	g_signal_handlers_destroy (self);
}

static GType
proton_plus_utils_filesystem_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { proton_plus_utils_value_filesystem_init, proton_plus_utils_value_filesystem_free_value, proton_plus_utils_value_filesystem_copy_value, proton_plus_utils_value_filesystem_peek_pointer, "p", proton_plus_utils_value_filesystem_collect_value, "p", proton_plus_utils_value_filesystem_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (ProtonPlusUtilsFilesystemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) proton_plus_utils_filesystem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProtonPlusUtilsFilesystem), 0, (GInstanceInitFunc) proton_plus_utils_filesystem_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType proton_plus_utils_filesystem_type_id;
	proton_plus_utils_filesystem_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ProtonPlusUtilsFilesystem", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return proton_plus_utils_filesystem_type_id;
}

GType
proton_plus_utils_filesystem_get_type (void)
{
	static volatile gsize proton_plus_utils_filesystem_type_id__once = 0;
	if (g_once_init_enter (&proton_plus_utils_filesystem_type_id__once)) {
		GType proton_plus_utils_filesystem_type_id;
		proton_plus_utils_filesystem_type_id = proton_plus_utils_filesystem_get_type_once ();
		g_once_init_leave (&proton_plus_utils_filesystem_type_id__once, proton_plus_utils_filesystem_type_id);
	}
	return proton_plus_utils_filesystem_type_id__once;
}

gpointer
proton_plus_utils_filesystem_ref (gpointer instance)
{
	ProtonPlusUtilsFilesystem * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
proton_plus_utils_filesystem_unref (gpointer instance)
{
	ProtonPlusUtilsFilesystem * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		PROTON_PLUS_UTILS_FILESYSTEM_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

