X-Git-Url: http://git.datanom.net/lensdb.git/blobdiff_plain/2c9438951b2f16a0470e7240bcb6f2da230ee547..refs/heads/release/0.9:/src/main.c diff --git a/src/main.c b/src/main.c index 351c627..d5c1bc4 100644 --- a/src/main.c +++ b/src/main.c @@ -26,6 +26,7 @@ #endif #include #include +#include #include #include #include "sqlite-storage.h" @@ -35,13 +36,15 @@ gint main(gint argc, gchar** argv) { gint status = 0; -// Scanner_t* sc = scanner_create("/home/mir/Pictures/Pictures/20211019_0012.jpg"); -// Scanner_t* sc = scanner_create("/home/mir/Pictures/Pictures/2024/09/14/Lndskrona Foto Festival/Lndskrona Foto Festival-8.ORF"); - Scanner_t* sc = scanner_create("/home/mir/Pictures/Pictures/2024/08/21/Fototur til Hejresøen/Fototur til Hejresøen-6.NEF"); - scanner_do_work(sc); - scanner_destroy(sc); - - gchar* path = g_path_get_dirname(argv[0]); + //gchar* path = g_path_get_dirname(argv[0]); + gchar* path = g_build_filename(g_get_user_config_dir(), PACKAGE, NULL); //g_strconcat(g_get_home_dir(), "/.local/share/", PACKAGE, NULL); + if (!g_file_test(path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { + if (g_mkdir(path, 0766)) { + fprintf(stderr, "%s: Failed to create dir for database\n", path); + return EXIT_FAILURE; + } + } + fprintf(stdout, "workdir: %s\n", path); if ((status = init_storage(path)) > 0) { fprintf(stderr, "%s: Failed to open DB\n", path); } else {