diff --git a/src/cli.c b/src/cli.c index 2576054..462cda9 100644 --- a/src/cli.c +++ b/src/cli.c @@ -41,6 +41,9 @@ void scan_args_destroy(scan_args_t *args) { if (args->name != NULL) { free(args->name); } + if (args->incremental != NULL) { + free(args->incremental); + } if (args->path != NULL) { free(args->path); } @@ -79,7 +82,7 @@ int scan_args_validate(scan_args_t *args, int argc, const char **argv) { } if (args->incremental != NULL) { - abs_path = abspath(args->incremental); + args->incremental = abspath(args->incremental); if (abs_path == NULL) { sist_log("main.c", SIST_WARNING, "Could not open original index! Disabled incremental scan feature."); args->incremental = NULL; diff --git a/src/io/store.c b/src/io/store.c index 9e08fac..d896ad4 100644 --- a/src/io/store.c +++ b/src/io/store.c @@ -143,3 +143,8 @@ GHashTable *store_read_all(store_t *store) { return table; } + +void store_copy(store_t *store, const char *destination) { + mkdir(destination, S_IWUSR | S_IRUSR | S_IXUSR); + mdb_env_copy(store->env, destination); +} diff --git a/src/io/store.h b/src/io/store.h index 5a8f04e..1d0fa82 100644 --- a/src/io/store.h +++ b/src/io/store.h @@ -27,4 +27,6 @@ char *store_read(store_t *store, char *key, size_t key_len, size_t *ret_vallen); GHashTable *store_read_all(store_t *store); +void store_copy(store_t *store, const char *destination); + #endif diff --git a/src/main.c b/src/main.c index 4c75f0e..09693c5 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,7 @@ #define EPILOG "Made by simon987 . Released under GPL-3.0" -static const char *const Version = "2.7.2"; +static const char *const Version = "2.7.3"; static const char *const usage[] = { "sist2 scan [OPTION]... PATH", "sist2 index [OPTION]... INDEX", @@ -244,6 +244,13 @@ void sist2_scan(scan_args_t *args) { } closedir(dir); store_destroy(source); + + snprintf(store_path, PATH_MAX, "%stags", args->incremental); + snprintf(dst_path, PATH_MAX, "%stags", ScanCtx.index.path); + mkdir(store_path, S_IWUSR | S_IRUSR | S_IXUSR); + store_t *source_tags = store_create(store_path, STORE_SIZE_TAG); + store_copy(source_tags, dst_path); + store_destroy(source_tags); } store_destroy(ScanCtx.index.store); diff --git a/src/static/search.html b/src/static/search.html index cf30b3e..af95c9c 100644 --- a/src/static/search.html +++ b/src/static/search.html @@ -11,7 +11,7 @@