Skip to content

Commit

Permalink
fix: check if extension local schemas dir exists before use
Browse files Browse the repository at this point in the history
  • Loading branch information
lleyton authored and mmstick committed Dec 11, 2023
1 parent aafc945 commit cf3c932
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,11 @@ function settings_new_id(schema_id: string): Settings | null {

function settings_new_schema(schema: string): Settings {
const GioSSS = Gio.SettingsSchemaSource;
// const schemaDir = Me.dir.get_child('schemas');
const schemaDir = Gio.File.new_for_path(get_current_path()).get_child('schemas');

// let schemaSource = schemaDir.query_exists(null)
// ? GioSSS.new_from_directory(get_current_path(), GioSSS.get_default(), false)
// : GioSSS.get_default();

// get_current_path()

let schemaSource = GioSSS.new_from_directory(`${get_current_path()}/schemas/`, GioSSS.get_default(), false);
let schemaSource = schemaDir.query_exists(null)
? GioSSS.new_from_directory(schemaDir.get_path(), GioSSS.get_default(), false)
: GioSSS.get_default();

const schemaObj = schemaSource.lookup(schema, true);

Expand Down

0 comments on commit cf3c932

Please sign in to comment.