Switch to unified view

a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.29 2006-04-28 07:54:38 dockes Exp $ (C) 2004 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.30 2006-09-08 09:02:47 dockes Exp $ (C) 2004 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
39
39
40
#ifndef NO_NAMESPACES
40
#ifndef NO_NAMESPACES
41
using namespace std;
41
using namespace std;
42
#endif /* NO_NAMESPACES */
42
#endif /* NO_NAMESPACES */
43
43
44
RclConfig::RclConfig()
44
RclConfig::RclConfig(const string *argcnf)
45
{
45
{
46
    zeroMe();
46
    zeroMe();
47
    // Compute our data dir name, typically /usr/local/share/recoll
47
    // Compute our data dir name, typically /usr/local/share/recoll
48
    const char *cdatadir = getenv("RECOLL_DATADIR");
48
    const char *cdatadir = getenv("RECOLL_DATADIR");
49
    if (cdatadir == 0) {
49
    if (cdatadir == 0) {
...
...
51
    m_datadir = RECOLL_DATADIR;
51
    m_datadir = RECOLL_DATADIR;
52
    } else {
52
    } else {
53
    m_datadir = cdatadir;
53
    m_datadir = cdatadir;
54
    }
54
    }
55
55
56
    const char *cp = getenv("RECOLL_CONFDIR");
56
    // Command line config name overrides environment
57
    if (cp) {
57
    if (argcnf && !argcnf->empty()) {
58
    m_confdir = cp;
58
    m_confdir = *argcnf;
59
    } else {
59
    } else {
60
  const char *cp = getenv("RECOLL_CONFDIR");
61
  if (cp) {
62
      m_confdir = cp;
63
  } else {
60
    m_confdir = path_home();
64
        m_confdir = path_home();
61
    m_confdir += ".recoll/";
65
        m_confdir += ".recoll/";
66
  }
62
    }
67
    }
63
64
    if (access(m_confdir.c_str(), 0) < 0) {
68
    if (access(m_confdir.c_str(), 0) < 0) {
65
    if (!initUserConfig())
69
    if (!initUserConfig())
66
        return;
70
        return;
67
    }
71
    }
68
72