diff options
author | fxqnlr <[email protected]> | 2023-04-24 19:00:04 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2023-04-24 19:00:04 +0200 |
commit | 96d400ca1275bf8444e5ad4dc6c8a06b01c3ea9d (patch) | |
tree | 740e6f16b78cfe9c8a1019580bef0de1a3491300 /src/db.rs | |
parent | 99c84b5a81f395f4f094b157019e84bfc4459df6 (diff) | |
download | modlist-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.rs | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -701,11 +701,9 @@ pub fn s_insert_column( | |||
701 | Ok(()) | 701 | Ok(()) |
702 | } | 702 | } |
703 | 703 | ||
704 | pub fn db_setup(config: Cfg) -> MLE<()> { | 704 | pub 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 ); |