Switch to unified view

a/src/query/recollq.cpp b/src/query/recollq.cpp
...
...
41
#include "wasatorcl.h"
41
#include "wasatorcl.h"
42
#include "internfile.h"
42
#include "internfile.h"
43
#include "wipedir.h"
43
#include "wipedir.h"
44
#include "transcode.h"
44
#include "transcode.h"
45
45
46
bool dump_contents(RclConfig *rclconfig, string& tmpdir, Rcl::Doc& doc)
46
bool dump_contents(RclConfig *rclconfig, string& tmpdir, Rcl::Doc& idoc)
47
{
47
{
48
    string fn = doc.url.substr(7);
49
    struct stat st;
50
    if (stat(fn.c_str(), &st) != 0) {
51
  cout << "No such file: " << fn << endl;
52
  return true;
53
    } 
54
    if (tmpdir.empty() || access(tmpdir.c_str(), 0) < 0) {
48
    if (tmpdir.empty() || access(tmpdir.c_str(), 0) < 0) {
55
    string reason;
49
    string reason;
56
    if (!maketmpdir(tmpdir, reason)) {
50
    if (!maketmpdir(tmpdir, reason)) {
57
        cerr << "Cannot create temporary directory: "
51
        cerr << "Cannot create temporary directory: "
58
         << reason << endl;
52
         << reason << endl;
59
        return false;
53
        return false;
60
    }
54
    }
61
    }
55
    }
62
    wipedir(tmpdir);
56
    wipedir(tmpdir);
63
    FileInterner interner(fn, &st, rclconfig, tmpdir, 
57
    FileInterner interner(idoc, rclconfig, tmpdir, 
64
                          FileInterner::FIF_forPreview, &doc.mimetype);
58
                          FileInterner::FIF_forPreview);
59
    Rcl::Doc fdoc;
60
    string ipath = idoc.ipath;
65
    if (interner.internfile(doc, doc.ipath)) {
61
    if (interner.internfile(fdoc, ipath)) {
66
    cout << doc.text << endl;
62
    cout << fdoc.text << endl;
67
    } else {
63
    } else {
68
  cout << "Cant intern: " << fn << endl;
64
  cout << "Cant turn to text:" << idoc.url << " | " << idoc.ipath << endl;
69
    }
65
    }
70
    return true;
66
    return true;
71
}
67
}
72
68
73
69