Correct placement of config.json file

This commit is contained in:
Ethan O'Brien
2024-07-10 22:40:19 -05:00
parent 66ad791ff8
commit e1e32a22b0
3 changed files with 15 additions and 7 deletions

View File

@@ -1,7 +1,6 @@
use rusqlite::{Connection, params, ToSql};
use std::sync::Mutex;
use json::{JsonValue, array};
use std::fs;
use crate::router::clear_rate::Live;
@@ -12,9 +11,7 @@ pub struct SQLite {
impl SQLite {
pub fn new(path: &str, setup: fn(&SQLite)) -> SQLite {
let args = crate::get_args();
fs::create_dir_all(&args.path).unwrap();
let conn = Connection::open(format!("{}/{}", args.path, path)).unwrap();
let conn = Connection::open(crate::get_data_path(path)).unwrap();
conn.execute("PRAGMA foreign_keys = ON;", ()).unwrap();
let instance = SQLite {
engine: Mutex::new(conn),