summaryrefslogtreecommitdiff
path: root/src/db.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-04-24 19:00:04 +0200
committerfxqnlr <[email protected]>2023-04-24 19:00:04 +0200
commit96d400ca1275bf8444e5ad4dc6c8a06b01c3ea9d (patch)
tree740e6f16b78cfe9c8a1019580bef0de1a3491300 /src/db.rs
parent99c84b5a81f395f4f094b157019e84bfc4459df6 (diff)
downloadmodlist-96d400ca1275bf8444e5ad4dc6c8a06b01c3ea9d.tar
modlist-96d400ca1275bf8444e5ad4dc6c8a06b01c3ea9d.tar.gz
modlist-96d400ca1275bf8444e5ad4dc6c8a06b01c3ea9d.zip
add auto create dirs, database and default config
Diffstat (limited to 'src/db.rs')
-rw-r--r--src/db.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/db.rs b/src/db.rs
index 2ffcff5..36fab75 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -701,11 +701,9 @@ pub fn s_insert_column(
701 Ok(()) 701 Ok(())
702} 702}
703 703
704pub fn db_setup(config: Cfg) -> MLE<()> { 704pub fn db_setup(path: &str) -> MLE<()> {
705 println!("Initiating database");
706 705
707 let data = format!("{}/data.db", config.data); 706 let connection = Connection::open(path)?;
708 let connection = Connection::open(data)?;
709 707
710 connection.execute_batch( 708 connection.execute_batch(
711 "CREATE TABLE 'user_config' ( 'id' TEXT, 'value' TEXT ); 709 "CREATE TABLE 'user_config' ( 'id' TEXT, 'value' TEXT );