Browse Source

Corrigido problema com o database

main
Julio Biason 3 years ago
parent
commit
e7e49e4ab1
  1. 7
      lib/src/database.rs
  2. 10
      lib/src/lib.rs

7
lib/src/database.rs

@ -17,6 +17,7 @@
*/
use std::path::Path;
use std::path::PathBuf;
use directories::ProjectDirs;
use sqlx::sqlite::Sqlite;
@ -41,9 +42,9 @@ async fn connect_with(filename: &Path) -> Result<Pool<Sqlite>, sqlx::Error> {
}
/// Return the default filename for the database.
fn default_filename() -> Path {
fn default_filename() -> PathBuf {
match ProjectDirs::from("me", "JulioBiason", "tin.sqlite3") {
Some(project_dir) => Path(project_dir.config_dir()),
None => Path("tin.sqlite3"),
Some(project_dir) => Path::new(project_dir.config_dir()).to_path_buf(),
None => Path::new("tin.sqlite3").to_path_buf(),
}
}

10
lib/src/lib.rs

@ -16,13 +16,5 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// mod database;
mod database;
mod domain;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

Loading…
Cancel
Save