Skip to content

Commit

Permalink
fix: glib schema generation for snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Apr 4, 2023
1 parent 9eba21c commit 5b6790b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
20 changes: 10 additions & 10 deletions resources/linux/snap/electron-launch
Original file line number Diff line number Diff line change
Expand Up @@ -162,41 +162,41 @@ function compile_giomodules {
if [ -f "$1/glib-2.0/gio-querymodules" ]; then
rm -rf "$GIO_MODULE_DIR"
ensure_dir_exists "$GIO_MODULE_DIR"
ln -s "$1"/gio/modules/*.so "$GIO_MODULE_DIR"
ln -s "$SNAP"/usr/lib/"$ARCH"/gio/modules/*.so "$GIO_MODULE_DIR"
"$1/glib-2.0/gio-querymodules" "$GIO_MODULE_DIR"
fi
}
if [ "$needs_update" = true ]; then
async_exec compile_giomodules "$SNAP/usr/lib/$ARCH"
async_exec compile_giomodules "/snap/core20/current/usr/lib/$ARCH"
fi

# Setup compiled gsettings schema
GS_SCHEMA_DIR="$SNAP_USER_DATA/.local/share/glib-2.0/schemas"
export GSETTINGS_SCHEMA_DIR="$SNAP_USER_DATA/.local/share/glib-2.0/schemas"
function compile_schemas {
if [ -f "$1" ]; then
rm -rf "$GS_SCHEMA_DIR"
ensure_dir_exists "$GS_SCHEMA_DIR"
rm -rf "$GSETTINGS_SCHEMA_DIR"
ensure_dir_exists "$GSETTINGS_SCHEMA_DIR"
for ((i = 0; i < ${#data_dirs_array[@]}; i++)); do
schema_dir="${data_dirs_array[$i]}/glib-2.0/schemas"
if [ -f "$schema_dir/gschemas.compiled" ]; then
# This directory already has compiled schemas
continue
fi
if [ -n "$(ls -A "$schema_dir"/*.xml 2>/dev/null)" ]; then
ln -s "$schema_dir"/*.xml "$GS_SCHEMA_DIR"
ln -s "$schema_dir"/*.xml "$GSETTINGS_SCHEMA_DIR"
fi
if [ -n "$(ls -A "$schema_dir"/*.override 2>/dev/null)" ]; then
ln -s "$schema_dir"/*.override "$GS_SCHEMA_DIR"
ln -s "$schema_dir"/*.override "$GSETTINGS_SCHEMA_DIR"
fi
done
# Only compile schemas if we copied anything
if [ -n "$(ls -A "$GS_SCHEMA_DIR"/*.xml "$GS_SCHEMA_DIR"/*.override 2>/dev/null)" ]; then
"$1" "$GS_SCHEMA_DIR"
if [ -n "$(ls -A "$GSETTINGS_SCHEMA_DIR"/*.xml "$GSETTINGS_SCHEMA_DIR"/*.override 2>/dev/null)" ]; then
"$1" "$GSETTINGS_SCHEMA_DIR"
fi
fi
}
if [ "$needs_update" = true ]; then
async_exec compile_schemas "$SNAP/usr/lib/$ARCH/glib-2.0/glib-compile-schemas"
async_exec compile_schemas "/snap/core20/current/usr/lib/$ARCH/glib-2.0/glib-compile-schemas"
fi

# Gdk-pixbuf loaders
Expand Down
3 changes: 3 additions & 0 deletions src/vs/platform/native/electron-main/nativeHostMainService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,12 +453,14 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
const gdkBackend = process.env['GDK_BACKEND'];
const gioModuleDir = process.env['GIO_MODULE_DIR'];
const gtkExePrefix = process.env['GTK_EXE_PREFIX'];
const gsettingsSchemaDir = process.env['GSETTINGS_SCHEMA_DIR'];
delete process.env['GDK_PIXBUF_MODULE_FILE'];
delete process.env['GDK_PIXBUF_MODULEDIR'];
delete process.env['GTK_IM_MODULE_FILE'];
delete process.env['GDK_BACKEND'];
delete process.env['GIO_MODULE_DIR'];
delete process.env['GTK_EXE_PREFIX'];
delete process.env['GSETTINGS_SCHEMA_DIR'];

shell.openExternal(url);

Expand All @@ -469,6 +471,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
process.env['GDK_BACKEND'] = gdkBackend;
process.env['GIO_MODULE_DIR'] = gioModuleDir;
process.env['GTK_EXE_PREFIX'] = gtkExePrefix;
process.env['GSETTINGS_SCHEMA_DIR'] = gsettingsSchemaDir;
}

moveItemToTrash(windowId: number | undefined, fullPath: string): Promise<void> {
Expand Down

0 comments on commit 5b6790b

Please sign in to comment.