]> git.sesse.net Git - plocate/blobdiff - plocate-build.cpp
Release plocate 1.1.7.
[plocate] / plocate-build.cpp
index 02b18d0e42e00dc577ad9d7160d2f53d05433bfb..028a1ee06c620d8274ae707ba1905041ac288a17 100644 (file)
@@ -83,10 +83,10 @@ void handle_directory(FILE *fp, DatabaseReceiver *receiver)
                int type = getc(fp);
                if (type == DBE_NORMAL) {
                        string filename = read_cstr(fp);
-                       receiver->add_file(dir_path + "/" + filename);
+                       receiver->add_file(dir_path + "/" + filename, unknown_dir_time);
                } else if (type == DBE_DIRECTORY) {
                        string dirname = read_cstr(fp);
-                       receiver->add_file(dir_path + "/" + dirname);
+                       receiver->add_file(dir_path + "/" + dirname, unknown_dir_time);
                } else {
                        return;  // Probably end.
                }
@@ -116,7 +116,7 @@ void read_plaintext(FILE *fp, DatabaseReceiver *receiver)
                }
                if (!s.empty() && s.back() == '\n')
                        s.pop_back();
-               receiver->add_file(move(s));
+               receiver->add_file(move(s), unknown_dir_time);
        }
 }
 
@@ -166,8 +166,8 @@ void do_build(const char *infile, const char *outfile, int block_size, bool plai
        }
        string dictionary = builder.train(1024);
 
-       DatabaseBuilder db(outfile, block_size, dictionary);
-       Corpus *corpus = db.start_corpus();
+       DatabaseBuilder db(outfile, /*owner=*/-1, block_size, dictionary, /*check_visibility=*/true);
+       DatabaseReceiver *corpus = db.start_corpus(/*store_dir_times=*/false);
        if (plaintext) {
                read_plaintext(infp, corpus);
        } else {
@@ -175,7 +175,7 @@ void do_build(const char *infile, const char *outfile, int block_size, bool plai
        }
        fclose(infp);
 
-       dprintf("Read %zu files from %s\n", corpus->num_files, infile);
+       dprintf("Read %zu files from %s\n", corpus->num_files_seen(), infile);
        db.finish_corpus();
 }
 
@@ -195,7 +195,7 @@ void usage()
 
 void version()
 {
-       printf("plocate-build %s\n", PLOCATE_VERSION);
+       printf("plocate-build %s\n", PACKAGE_VERSION);
        printf("Copyright 2020 Steinar H. Gunderson\n");
        printf("License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>.\n");
        printf("This is free software: you are free to change and redistribute it.\n");