Check gschemas.compiled existance.

This commit is contained in:
Kolan Sh 2016-08-02 16:48:04 +03:00
parent ea12d09600
commit ae7ea2b64b
1 changed files with 6 additions and 3 deletions

View File

@ -14,11 +14,14 @@ namespace LAview.Desktop {
}
public AppSettings () throws Error {
string schema_file = AppDirs.settings_dir+"/gschemas.compiled";
if (!File.new_for_path (schema_file).query_exists ())
throw new IOError.NOT_FOUND ("File "+schema_file+" not found");
SettingsSchemaSource sss = new SettingsSchemaSource.from_directory (AppDirs.settings_dir, null, false);
SettingsSchema schema = sss.lookup ("ws.backbone.laview.desktop-"+Config.VERSION_MAJOR.to_string(), false);
string schema_name = "ws.backbone.laview.desktop-"+Config.VERSION_MAJOR.to_string();
SettingsSchema schema = sss.lookup (schema_name, false);
if (schema == null) {
stderr.printf ("ID not found.\n");
throw new IOError.NOT_FOUND (_("File ")+AppDirs.settings_dir+"/gschemas.compiled"+_(" not found"));
throw new IOError.NOT_FOUND ("Schema "+schema_name+" not found in "+schema_file);
}
settings = new Settings.full (schema, null, null);