diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-03-22 21:42:28 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-03-22 21:42:28 +0000 |
commit | 7823db2137d8079bcf512aba4ce46f1373693517 (patch) | |
tree | 52a693b3502fd3382337530e45ff9d36b24c41bf /src/libutil | |
parent | 777e13b94b2da466c16a5836b52413aa9d246cd5 (diff) | |
download | guix-7823db2137d8079bcf512aba4ce46f1373693517.tar.gz |
* Some more nesting.
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.cc | 36 | ||||
-rw-r--r-- | src/libutil/util.hh | 1 |
2 files changed, 27 insertions, 10 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 768acf811c..bf14e8aadf 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -144,11 +144,11 @@ Strings readDirectory(const Path & path) } -void deletePath(const Path & path) +static void _deletePath(const Path & path) { checkInterrupt(); - printMsg(lvlVomit, format("deleting path `%1%'") % path); + printMsg(lvlVomit, format("%1%") % path); struct stat st; if (lstat(path.c_str(), &st)) @@ -164,7 +164,7 @@ void deletePath(const Path & path) } for (Strings::iterator i = names.begin(); i != names.end(); ++i) - deletePath(path + "/" + *i); + _deletePath(path + "/" + *i); } if (remove(path.c_str()) == -1) @@ -172,6 +172,14 @@ void deletePath(const Path & path) } +void deletePath(const Path & path) +{ + startNest(nest, lvlDebug, + format("recursively deleting path `%1%'") % path); + _deletePath(path); +} + + void makePathReadOnly(const Path & path) { checkInterrupt(); @@ -238,11 +246,7 @@ Nest::Nest() Nest::~Nest() { - if (nest) { - nestingLevel--; - if (logType == ltEscapes) - cerr << "\033[q"; - } + close(); } @@ -259,14 +263,26 @@ void Nest::open(Verbosity level, const format & f) { if (level <= verbosity) { if (logType == ltEscapes) - cerr << "\033[" << escVerbosity(level) << "p"; - printMsg_(level, f); + cerr << "\033[" << escVerbosity(level) << "p" + << f.str() << "\n"; + else + printMsg_(level, f); nest = true; nestingLevel++; } } +void Nest::close() +{ + if (nest) { + nestingLevel--; + if (logType == ltEscapes) + cerr << "\033[q"; + } +} + + void printMsg_(Verbosity level, const format & f) { checkInterrupt(); diff --git a/src/libutil/util.hh b/src/libutil/util.hh index ac96d7fc1a..54673c28c6 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -127,6 +127,7 @@ public: Nest(); ~Nest(); void open(Verbosity level, const format & f); + void close(); }; void printMsg_(Verbosity level, const format & f); |