Project

General

Profile

Change request #198

Util::findConfig refactor a bit

Added by David Demelier almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Low
Category:
-
Target version:
Start date:
09/26/2013
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:
MFD after:
10/03/2013
MFD revision:
Branch:
Bookmark:
Platform:

Description

Util::findConfig require lot of code duplicated between irccdctl and irccd. The idea is to exit from findConfig if no config was found like:

Util::findConfig("irccd.conf", Util::HintAll, [&] (const std::string &path) -> bool {
    if (success to open)
        ...
        return true;

    return false;
});

/*
 * Here if we don't have succeded at all, the code is not reached and Util::findConfig logs:
 *
 * <progname>: unable to find irccd.conf, exiting.
 * <progname>: have tried ~/.config/irccd/irccd.conf
 * <progname>: have tried ./irccd.conf
 * <progname>: have tried /usr/local/etc/irccd.conf
 */

New hints can be OR'ed to specify paths like:

  • Util::HintUser -> ~/.config/irccd (or Windows equivalent)
  • Util::HintSystem -> /usr/local/etc (or Windows exe path + ../etc)
  • Util::HintLocal -> ./
  • Util::HintAll -> All of above

History

#1

Updated by David Demelier almost 6 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
#2

Updated by David Demelier almost 6 years ago

  • MFD after set to 10/03/2013
#3

Updated by David Demelier almost 6 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF