diff 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
line wrap: on
line diff
--- a/scid/scid.c	Wed Aug 03 15:18:09 2022 +0200
+++ b/scid/scid.c	Thu Aug 04 06:09:54 2022 +0200
@@ -4,6 +4,7 @@
 #include "db.h"
 #include "log.h"
 #include "scid.h"
+#include "theme.h"
 
 struct scid scid = {
 	.dbpath = VARDIR "/db/sci/sci.db"
@@ -17,19 +18,14 @@
 
 	if (db_open(scid.dbpath) < 0)
 		log_die("abort: unable to open database");
+
+	scid.theme = theme_open(scid.themedir);
 }
 
 const char *
 scid_theme_path(const char *filename)
 {
-	assert(filename);
-
-	/* Build path to the template file. */
-	static _Thread_local char path[PATH_MAX];
-
-	snprintf(path, sizeof (path), "%s/%s", scid.themedir, filename);
-
-	return path;
+	return theme_path(scid.theme, filename);
 }
 
 void