Mercurial > sci
comparison scid/scid.c @ 28:4c16bb25e4f1
scid: implement themes in javascript
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 04 Aug 2022 06:09:54 +0200 |
parents | 7e10cace67a3 |
children | 43333d18e4b8 |
comparison
equal
deleted
inserted
replaced
27:dae2de19ca5d | 28:4c16bb25e4f1 |
---|---|
2 #include <stdio.h> | 2 #include <stdio.h> |
3 | 3 |
4 #include "db.h" | 4 #include "db.h" |
5 #include "log.h" | 5 #include "log.h" |
6 #include "scid.h" | 6 #include "scid.h" |
7 #include "theme.h" | |
7 | 8 |
8 struct scid scid = { | 9 struct scid scid = { |
9 .dbpath = VARDIR "/db/sci/sci.db" | 10 .dbpath = VARDIR "/db/sci/sci.db" |
10 }; | 11 }; |
11 | 12 |
15 log_open("scid"); | 16 log_open("scid"); |
16 log_info("opening database %s", scid.dbpath); | 17 log_info("opening database %s", scid.dbpath); |
17 | 18 |
18 if (db_open(scid.dbpath) < 0) | 19 if (db_open(scid.dbpath) < 0) |
19 log_die("abort: unable to open database"); | 20 log_die("abort: unable to open database"); |
21 | |
22 scid.theme = theme_open(scid.themedir); | |
20 } | 23 } |
21 | 24 |
22 const char * | 25 const char * |
23 scid_theme_path(const char *filename) | 26 scid_theme_path(const char *filename) |
24 { | 27 { |
25 assert(filename); | 28 return theme_path(scid.theme, filename); |
26 | |
27 /* Build path to the template file. */ | |
28 static _Thread_local char path[PATH_MAX]; | |
29 | |
30 snprintf(path, sizeof (path), "%s/%s", scid.themedir, filename); | |
31 | |
32 return path; | |
33 } | 29 } |
34 | 30 |
35 void | 31 void |
36 scid_finish(void) | 32 scid_finish(void) |
37 { | 33 { |