pgup/down in result list
This commit is contained in:
parent
0122545ece
commit
52fa7836b7
@ -5,18 +5,21 @@
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= recoll
|
||||
PORTVERSION= 1.0.13
|
||||
CATEGORIES= deskutils
|
||||
MASTER_SITES= http://www.lesbonscomptes.com/recoll/
|
||||
PORTNAME= recoll
|
||||
PORTVERSION= 1.0.14
|
||||
CATEGORIES= deskutils
|
||||
MASTER_SITES= http://www.lesbonscomptes.com/recoll/
|
||||
|
||||
MAINTAINER= jean-francois.dockes@wanadoo.fr
|
||||
COMMENT= A personal full text search package, based on QT and Xapian
|
||||
MAINTAINER= jean-francois.dockes@wanadoo.fr
|
||||
COMMENT= A personal full text search package, based on QT and Xapian
|
||||
|
||||
LIB_DEPENDS= xapian.8:${PORTSDIR}/databases/xapian-core \
|
||||
qt-mt.3:${PORTSDIR}/x11-toolkits/qt33
|
||||
BUILD_DEPENDS= qmake:${PORTSDIR}/devel/qmake
|
||||
LIB_DEPENDS= xapian.8:${PORTSDIR}/databases/xapian-core \
|
||||
qt-mt.3:${PORTSDIR}/x11-toolkits/qt33
|
||||
|
||||
GNU_CONFIGURE= yes
|
||||
USE_GMAKE= yes
|
||||
USE_QT_VER= 3
|
||||
MAKE_ENV= QTDIR="${QT_PREFIX}" QMAKESPEC="freebsd-g++"
|
||||
GNU_CONFIGURE= yes
|
||||
USE_GMAKE= yes
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
MD5 (recoll-1.0.13.tar.gz) = b4fd87b467e25e8f6ec96e86a8196181
|
||||
SHA256 (recoll-1.0.13.tar.gz) = d8407c5090a35e6196f4cef6b9f787f94e89a2746f995010b3b7ac6af9cb6bd7
|
||||
SIZE (recoll-1.0.13.tar.gz) = 328105
|
||||
MD5 (recoll-1.0.14.tar.gz) = 223037883f26294405491e0e2c8ab33b
|
||||
SHA256 (recoll-1.0.14.tar.gz) = 0552c467c2c1c8eedc98a1fcc457304e29f080c2afe11fad5c55b88b4cf3548f
|
||||
SIZE (recoll-1.0.14.tar.gz) = 328158
|
||||
|
||||
@ -20,3 +20,5 @@ Features:
|
||||
necessary.
|
||||
* An indexer which runs either as a thread inside the GUI or as an
|
||||
external, cron'able program.
|
||||
|
||||
WWW: http://www.lesbonscomptes.com/recoll/
|
||||
|
||||
@ -1,30 +1,30 @@
|
||||
bin/recoll
|
||||
bin/recollindex
|
||||
share/recoll/examples/mimeconf
|
||||
share/recoll/examples/mimemap
|
||||
share/recoll/examples/recoll.conf
|
||||
share/recoll/filters/rcldoc
|
||||
share/recoll/filters/rclgaim
|
||||
share/recoll/filters/rclpdf
|
||||
share/recoll/filters/rclps
|
||||
share/recoll/filters/rclrtf
|
||||
share/recoll/filters/rclsoff
|
||||
share/recoll/filters/rcluncomp
|
||||
share/recoll/images/document.png
|
||||
share/recoll/images/drawing.png
|
||||
share/recoll/images/html.png
|
||||
share/recoll/images/message.png
|
||||
share/recoll/images/mozilla_doc.png
|
||||
share/recoll/images/pdf.png
|
||||
share/recoll/images/postscript.png
|
||||
share/recoll/images/presentation.png
|
||||
share/recoll/images/soffice.png
|
||||
share/recoll/images/spreadsheet.png
|
||||
share/recoll/images/txt.png
|
||||
share/recoll/images/wordprocessing.png
|
||||
share/recoll/translations/recoll_fr.qm
|
||||
@dirrm share/recoll/examples
|
||||
@dirrm share/recoll/filters
|
||||
@dirrm share/recoll/images
|
||||
@dirrm share/recoll/translations
|
||||
@dirrm share/recoll
|
||||
%%DATADIR%%/examples/mimeconf
|
||||
%%DATADIR%%/examples/mimemap
|
||||
%%DATADIR%%/examples/recoll.conf
|
||||
%%DATADIR%%/filters/rcldoc
|
||||
%%DATADIR%%/filters/rclgaim
|
||||
%%DATADIR%%/filters/rclpdf
|
||||
%%DATADIR%%/filters/rclps
|
||||
%%DATADIR%%/filters/rclrtf
|
||||
%%DATADIR%%/filters/rclsoff
|
||||
%%DATADIR%%/filters/rcluncomp
|
||||
%%DATADIR%%/images/document.png
|
||||
%%DATADIR%%/images/drawing.png
|
||||
%%DATADIR%%/images/html.png
|
||||
%%DATADIR%%/images/message.png
|
||||
%%DATADIR%%/images/mozilla_doc.png
|
||||
%%DATADIR%%/images/pdf.png
|
||||
%%DATADIR%%/images/postscript.png
|
||||
%%DATADIR%%/images/presentation.png
|
||||
%%DATADIR%%/images/soffice.png
|
||||
%%DATADIR%%/images/spreadsheet.png
|
||||
%%DATADIR%%/images/txt.png
|
||||
%%DATADIR%%/images/wordprocessing.png
|
||||
%%DATADIR%%/translations/recoll_fr.qm
|
||||
@dirrm %%DATADIR%%/examples
|
||||
@dirrm %%DATADIR%%/filters
|
||||
@dirrm %%DATADIR%%/images
|
||||
@dirrm %%DATADIR%%/translations
|
||||
@dirrm %%DATADIR%%
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.16 2005-12-05 14:09:16 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.17 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
@ -9,12 +9,11 @@ static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.16 2005-12-05 14:09:16 dockes E
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "rclconfig.h"
|
||||
#include "pathut.h"
|
||||
#include "rclconfig.h"
|
||||
#include "conftree.h"
|
||||
#include "debuglog.h"
|
||||
#include "smallut.h"
|
||||
#include "pathut.h"
|
||||
#include "copyfile.h"
|
||||
|
||||
#ifndef NO_NAMESPACES
|
||||
@ -29,8 +28,7 @@ static bool createConfig(string &reason)
|
||||
const char *cprefix = getenv("RECOLL_PREFIX");
|
||||
if (cprefix == 0)
|
||||
cprefix = RECOLL_PREFIX;
|
||||
string prefix(cprefix);
|
||||
path_cat(prefix, "share/recoll/examples");
|
||||
string prefix = path_cat(cprefix, "share/recoll/examples");
|
||||
|
||||
string recolldir = path_tildexpand("~/.recoll");
|
||||
if (mkdir(recolldir.c_str(), 0755) < 0) {
|
||||
@ -39,10 +37,8 @@ static bool createConfig(string &reason)
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < ncffiles; i++) {
|
||||
string src = prefix;
|
||||
path_cat(src, string(configfiles[i]));
|
||||
string dst = recolldir;
|
||||
path_cat(dst, string(configfiles[i]));
|
||||
string src = path_cat((const string&)prefix, string(configfiles[i]));
|
||||
string dst = path_cat((const string&)recolldir, string(configfiles[i]));
|
||||
if (!copyfile(src.c_str(), dst.c_str(), reason)) {
|
||||
LOGERR(("Copyfile failed: %s\n", reason.c_str()));
|
||||
return false;
|
||||
@ -70,8 +66,7 @@ RclConfig::RclConfig()
|
||||
confdir = path_home();
|
||||
confdir += ".recoll/";
|
||||
}
|
||||
string cfilename = confdir;
|
||||
path_cat(cfilename, "recoll.conf");
|
||||
string cfilename = path_cat(confdir, "recoll.conf");
|
||||
|
||||
if (access(confdir.c_str(), 0) != 0 || access(cfilename.c_str(), 0) != 0) {
|
||||
if (!createConfig(reason))
|
||||
@ -92,8 +87,7 @@ RclConfig::RclConfig()
|
||||
if (!conf->get("mimemapfile", mimemapfile, "")) {
|
||||
mimemapfile = "mimemap";
|
||||
}
|
||||
string mpath = confdir;
|
||||
path_cat(mpath, mimemapfile);
|
||||
string mpath = path_cat(confdir, mimemapfile);
|
||||
mimemap = new ConfTree(mpath.c_str(), true);
|
||||
if (mimemap == 0 ||
|
||||
(mimemap->getStatus() != ConfSimple::STATUS_RO &&
|
||||
@ -108,8 +102,7 @@ RclConfig::RclConfig()
|
||||
if (!conf->get("mimeconffile", mimeconffile, "")) {
|
||||
mimeconffile = "mimeconf";
|
||||
}
|
||||
mpath = confdir;
|
||||
path_cat(mpath, mimeconffile);
|
||||
mpath = path_cat(confdir, mimeconffile);
|
||||
mimeconf = new ConfTree(mpath.c_str(), true);
|
||||
if (mimeconf == 0 ||
|
||||
(mimeconf->getStatus() != ConfSimple::STATUS_RO &&
|
||||
@ -230,17 +223,15 @@ string find_filter(RclConfig *conf, const string &icmd)
|
||||
const char *cp;
|
||||
|
||||
if (cp = getenv("RECOLL_FILTERSDIR")) {
|
||||
cmd = cp;
|
||||
path_cat(cmd, icmd);
|
||||
cmd = path_cat(cp, icmd);
|
||||
if (access(cmd.c_str(), X_OK) == 0)
|
||||
return cmd;
|
||||
} else if (conf->getConfParam(string("filtersdir"), cmd)) {
|
||||
path_cat(cmd, icmd);
|
||||
cmd = path_cat(cmd, icmd);
|
||||
if (access(cmd.c_str(), X_OK) == 0)
|
||||
return cmd;
|
||||
} else {
|
||||
cmd = conf->getConfDir();
|
||||
path_cat(cmd, icmd);
|
||||
cmd = path_cat(conf->getConfDir(), icmd);
|
||||
if (access(cmd.c_str(), X_OK) == 0)
|
||||
return cmd;
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ GENERATE_HTML = YES
|
||||
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
||||
# put in front of it. If left blank `html' will be used as the default path.
|
||||
|
||||
HTML_OUTPUT = html
|
||||
HTML_OUTPUT = docprog_html
|
||||
|
||||
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
|
||||
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
documentation:
|
||||
doxygen Doxyfile
|
||||
clean:
|
||||
rm -f html/*
|
||||
rm -f docprog_html/*
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ external filter, which will probably be the simpler solution in most cases.
|
||||
\section extfilts External filters
|
||||
|
||||
Filters are programs (usually shell scripts) that will turn a document of
|
||||
foreign type into something that Recoll can understand. Html was chosen as
|
||||
foreign type into something that Recoll can understand. HTML was chosen as
|
||||
a pivot format for its ability to carry structured information.
|
||||
|
||||
The meta-information tags that Recoll will use at the moment are the
|
||||
@ -33,15 +33,15 @@ following:
|
||||
- keywords
|
||||
- description
|
||||
|
||||
For an example, you can take a look, at rclsoff which translates openoffice
|
||||
documents.
|
||||
For an example, you can take a look at the rclsoff filter which translates
|
||||
openoffice documents.
|
||||
|
||||
The filter is executed with the input file name as a parameter and should
|
||||
output the result to stdout.
|
||||
|
||||
\section extassoc Associating a filter to a mime type
|
||||
|
||||
This is done in mimeconf. Take a look at the file, the format is
|
||||
self-explanatory.
|
||||
This is done in the mimeconf configuration file. Take a look at the file,
|
||||
the format is self-explanatory.
|
||||
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.21 2005-12-05 14:57:54 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.22 2005-12-13 12:42:59 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
@ -38,6 +38,8 @@ bool showicons;
|
||||
string iconsdir;
|
||||
RclDHistory *history;
|
||||
|
||||
static string dbdir;
|
||||
|
||||
void getQueryStemming(bool &dostem, std::string &stemlang)
|
||||
{
|
||||
string param;
|
||||
@ -51,20 +53,14 @@ void getQueryStemming(bool &dostem, std::string &stemlang)
|
||||
|
||||
bool maybeOpenDb(string &reason)
|
||||
{
|
||||
if (!rcldb)
|
||||
if (!rcldb) {
|
||||
reason = "Internal error: db not created";
|
||||
return false;
|
||||
}
|
||||
if (!rcldb->isopen() && !rcldb->open(dbdir, Rcl::Db::DbRO)) {
|
||||
reason = "Could not open database in " +
|
||||
dbdir + " wait for indexing to complete?";
|
||||
return false;
|
||||
if (!rcldb->isopen()) {
|
||||
string dbdir;
|
||||
if (rclconfig->getConfParam(string("dbdir"), dbdir) == 0) {
|
||||
reason = "No db directory in configuration";
|
||||
return false;
|
||||
}
|
||||
dbdir = path_tildexpand(dbdir);
|
||||
if (!rcldb->open(dbdir, Rcl::Db::DbRO)) {
|
||||
reason = "Could not open database in " +
|
||||
dbdir + " wait for indexing to complete?";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -134,7 +130,6 @@ int main( int argc, char ** argv )
|
||||
exit(1);
|
||||
}
|
||||
|
||||
string dbdir;
|
||||
if (rclconfig->getConfParam(string("dbdir"), dbdir) == 0) {
|
||||
// Note: this will have to be replaced by a call to a
|
||||
// configuration buildin dialog for initial configuration
|
||||
@ -143,10 +138,10 @@ int main( int argc, char ** argv )
|
||||
"No db directory in configuration"));
|
||||
exit(1);
|
||||
}
|
||||
dbdir = path_tildexpand(dbdir);
|
||||
|
||||
// Translations for Recoll
|
||||
string translatdir = string(recollsharedir);
|
||||
path_cat(translatdir, "translations");
|
||||
string translatdir = path_cat(recollsharedir, "translations");
|
||||
QTranslator translator( 0 );
|
||||
// QTextCodec::locale() returns $LANG
|
||||
translator.load( QString("recoll_") + QTextCodec::locale(),
|
||||
@ -157,8 +152,7 @@ int main( int argc, char ** argv )
|
||||
rclconfig->getConfParam("showicons", &showicons);
|
||||
rclconfig->getConfParam("iconsdir", iconsdir);
|
||||
if (iconsdir.empty()) {
|
||||
iconsdir = string(recollsharedir);
|
||||
path_cat(iconsdir, "images");
|
||||
iconsdir = path_cat(recollsharedir, "images");
|
||||
} else {
|
||||
iconsdir = path_tildexpand(iconsdir);
|
||||
}
|
||||
@ -170,11 +164,9 @@ int main( int argc, char ** argv )
|
||||
exit(1);
|
||||
}
|
||||
|
||||
string historyfile = rclconfig->getConfDir();
|
||||
path_cat(historyfile, "history");
|
||||
string historyfile = path_cat(rclconfig->getConfDir(), "history");
|
||||
history = new RclDHistory(historyfile);
|
||||
|
||||
dbdir = path_tildexpand(dbdir);
|
||||
|
||||
rcldb = new Rcl::Db;
|
||||
|
||||
|
||||
@ -398,6 +398,8 @@
|
||||
<slot>reslistTE_delayedclick()</slot>
|
||||
<slot>startSimpleSearch()</slot>
|
||||
<slot>startAdvSearch( Rcl::AdvSearchData sdata )</slot>
|
||||
<slot>resPageUpOrBack()</slot>
|
||||
<slot>resPageDownOrNext()</slot>
|
||||
<slot>resultPageBack()</slot>
|
||||
<slot>showResultPage()</slot>
|
||||
<slot>previewClosed( Preview * w )</slot>
|
||||
|
||||
@ -66,7 +66,12 @@ void RecollMain::init()
|
||||
sortform = 0;
|
||||
docsource = 0;
|
||||
sortwidth = 0;
|
||||
|
||||
// We manage pgup/down, but let ie the arrows for the editor to process
|
||||
reslistTE->installEventFilter(this);
|
||||
reslistTE->viewport()->installEventFilter(this);
|
||||
// reslistTE->viewport()->setFocusPolicy(QWidget::NoFocus);
|
||||
|
||||
}
|
||||
|
||||
// We also want to get rid of the advanced search form and previews
|
||||
@ -78,7 +83,8 @@ bool RecollMain::close(bool)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//#define SHOWEVENTS
|
||||
#if defined(SHOWEVENTS)
|
||||
static const char *eventTypeToStr(int tp)
|
||||
{
|
||||
switch (tp) {
|
||||
@ -167,12 +173,20 @@ static const char *eventTypeToStr(int tp)
|
||||
// ^Q thing is necessary (we have an action for this)?
|
||||
bool RecollMain::eventFilter( QObject * target, QEvent * event )
|
||||
{
|
||||
// LOGDEB(("RecollMain::eventFilter target %p, event %s\n", target,
|
||||
// eventTypeToStr(int(event->type()))));
|
||||
#if defined(SHOWEVENTS)
|
||||
LOGDEB(("RecollMain::eventFilter target %p, event %s\n", target,
|
||||
eventTypeToStr(int(event->type()))));
|
||||
#endif
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = (QKeyEvent *)event;
|
||||
if (keyEvent->key() == Key_Q && (keyEvent->state() & ControlButton)) {
|
||||
recollNeedsExit = 1;
|
||||
} else if (keyEvent->key() == Key_Prior) {
|
||||
resPageUpOrBack();
|
||||
return true;
|
||||
} else if (keyEvent->key() == Key_Next) {
|
||||
resPageDownOrNext();
|
||||
return true;
|
||||
}
|
||||
} else if (target == reslistTE->viewport()) {
|
||||
// We don't want btdown+drag+btup to be a click ! So monitor
|
||||
@ -413,6 +427,28 @@ void RecollMain::startAdvSearch(Rcl::AdvSearchData sdata)
|
||||
showResultPage();
|
||||
}
|
||||
|
||||
// Page Up/Down: we don't try to check if current paragraph is last or
|
||||
// first. We just page up/down and check if viewport moved. If it did,
|
||||
// fair enough, else we go to next/previous result page.
|
||||
void RecollMain::resPageUpOrBack()
|
||||
{
|
||||
int vpos = reslistTE->contentsY();
|
||||
reslistTE->moveCursor(QTextEdit::MovePgUp, false);
|
||||
if (vpos == reslistTE->contentsY())
|
||||
resultPageBack();
|
||||
}
|
||||
void RecollMain::resPageDownOrNext()
|
||||
{
|
||||
int vpos = reslistTE->contentsY();
|
||||
reslistTE->moveCursor(QTextEdit::MovePgDown, false);
|
||||
LOGDEB(("RecollMain::resPageDownOrNext: vpos before %d, after %d\n",
|
||||
vpos, reslistTE->contentsY()));
|
||||
if (vpos == reslistTE->contentsY())
|
||||
showResultPage();
|
||||
}
|
||||
|
||||
// Show previous page of results. We just set the current number back
|
||||
// 2 pages and show next page.
|
||||
void RecollMain::resultPageBack()
|
||||
{
|
||||
if (reslist_winfirst <= 0)
|
||||
@ -457,9 +493,15 @@ void RecollMain::showResultPage()
|
||||
|
||||
int last = MIN(resCnt-reslist_winfirst, respagesize);
|
||||
|
||||
string alltext;
|
||||
|
||||
// Insert results if any in result list window
|
||||
// Insert results if any in result list window. We have to send
|
||||
// the text to the widgets, because we need the paragraph number
|
||||
// each time we add a result paragraph (its diffult and
|
||||
// error-prone to compute the paragraph numbers in parallel. We
|
||||
// would like to disable updates while we're doing this, but
|
||||
// couldn't find a way to make it work, the widget seems to become
|
||||
// confused if appended while updates are disabled
|
||||
// reslistTE->setUpdatesEnabled(false);
|
||||
for (int i = 0; i < last; i++) {
|
||||
string sh;
|
||||
doc.erase();
|
||||
@ -477,13 +519,11 @@ void RecollMain::showResultPage()
|
||||
QString line = "<p><font size=+1><b>";
|
||||
line += docsource->title().c_str();
|
||||
line += "</b></font><br>";
|
||||
//alltext.append(line.utf8());
|
||||
reslistTE->append(line);
|
||||
line = tr("<b>Displaying results starting at index"
|
||||
" %1 (maximum set size %2)</b></p>\n")
|
||||
.arg(reslist_winfirst+1)
|
||||
.arg(resCnt);
|
||||
//alltext.append(line.utf8());
|
||||
reslistTE->append(line);
|
||||
}
|
||||
|
||||
@ -544,7 +584,6 @@ void RecollMain::showResultPage()
|
||||
"<i>" + doc.url + +"</i><br></p>\n";
|
||||
|
||||
QString str = QString::fromUtf8(result.c_str(), result.length());
|
||||
//alltext.append(str.utf8());
|
||||
reslistTE->append(str);
|
||||
|
||||
pageParaToReldocnums[reslistTE->paragraphs()-1] = i;
|
||||
@ -559,14 +598,16 @@ void RecollMain::showResultPage()
|
||||
} else {
|
||||
// Restore first in win parameter that we shouln't have incremented
|
||||
reslistTE->append(tr("<p>"
|
||||
/*"<img align=\"left\" source=\"myimage\">"*/
|
||||
"<b>No results found</b>"
|
||||
"<br>"));
|
||||
/*"<img align=\"left\" source=\"myimage\">"*/
|
||||
"<b>No results found</b>"
|
||||
"<br>"));
|
||||
reslist_winfirst -= respagesize;
|
||||
if (reslist_winfirst < 0)
|
||||
reslist_winfirst = -1;
|
||||
}
|
||||
|
||||
//reslistTE->setUpdatesEnabled(true);reslistTE->sync();reslistTE->repaint();
|
||||
|
||||
#if 0
|
||||
{
|
||||
FILE *fp = fopen("/tmp/reslistdebug", "w");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.43 2005-12-05 10:39:20 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.44 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
@ -501,8 +501,7 @@ bool Rcl::Db::needUpdate(const string &filename, const struct stat *stp)
|
||||
/// Compute name of stem db for given base database and language
|
||||
static string stemdbname(const string& basename, string lang)
|
||||
{
|
||||
string nm = basename;
|
||||
path_cat(nm, string("stem_") + lang);
|
||||
string nm = path_cat(basename, string("stem_") + lang);
|
||||
return nm;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.5 2005-11-24 07:16:16 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.6 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#ifndef TEST_FSTREEWALK
|
||||
@ -128,8 +128,7 @@ FsTreeWalker::Status FsTreeWalker::walk(const string &top,
|
||||
}
|
||||
|
||||
{
|
||||
string fn = top;
|
||||
path_cat(fn, ent->d_name);
|
||||
string fn = path_cat(top, ent->d_name);
|
||||
|
||||
struct stat st;
|
||||
int statret = (data->options & FtwFollow) ? stat(fn.c_str(), &st) :
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.5 2005-11-24 07:16:16 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.6 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#ifndef TEST_PATHUT
|
||||
@ -12,6 +12,18 @@ static char rcsid[] = "@(#$Id: pathut.cpp,v 1.5 2005-11-24 07:16:16 dockes Exp $
|
||||
using std::string;
|
||||
#endif /* NO_NAMESPACES */
|
||||
|
||||
void path_catslash(std::string &s) {
|
||||
if (s.empty() || s[s.length() - 1] != '/')
|
||||
s += '/';
|
||||
}
|
||||
|
||||
std::string path_cat(const std::string &s1, const std::string &s2) {
|
||||
std::string res = s1;
|
||||
path_catslash(res);
|
||||
res += s2;
|
||||
return res;
|
||||
}
|
||||
|
||||
string path_getfather(const string &s) {
|
||||
string father = s;
|
||||
|
||||
|
||||
@ -1,18 +1,11 @@
|
||||
#ifndef _PATHUT_H_INCLUDED_
|
||||
#define _PATHUT_H_INCLUDED_
|
||||
/* @(#$Id: pathut.h,v 1.3 2005-01-31 14:31:10 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: pathut.h,v 1.4 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
|
||||
inline void path_catslash(std::string &s) {
|
||||
if (s.empty() || s[s.length() - 1] != '/')
|
||||
s += '/';
|
||||
}
|
||||
inline void path_cat(std::string &s1, const std::string &s2) {
|
||||
path_catslash(s1);
|
||||
s1 += s2;
|
||||
}
|
||||
|
||||
extern void path_catslash(std::string &s);
|
||||
extern std::string path_cat(const std::string &s1, const std::string &s2);
|
||||
extern std::string path_getsimple(const std::string &s);
|
||||
extern std::string path_getfather(const std::string &s);
|
||||
extern std::string path_home();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.10 2005-11-25 14:36:45 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.11 2005-12-13 12:43:00 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
#ifndef TEST_SMALLUT
|
||||
#include <string>
|
||||
@ -27,8 +27,8 @@ bool maketmpdir(string& tdir)
|
||||
tmpdir = getenv("TMPDIR");
|
||||
if (!tmpdir)
|
||||
tmpdir = "/tmp";
|
||||
tdir = tmpdir;
|
||||
path_cat(tdir, "rcltmpXXXXXX");
|
||||
tdir = path_cat(tmpdir, "rcltmpXXXXXX");
|
||||
|
||||
{
|
||||
char *cp = strdup(tdir.c_str());
|
||||
if (!cp) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: wipedir.cpp,v 1.3 2005-11-24 07:16:16 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: wipedir.cpp,v 1.4 2005-12-13 12:43:00 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#ifndef TEST_WIPEDIR
|
||||
@ -50,8 +50,7 @@ int wipedir(const string& dir)
|
||||
if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
|
||||
continue;
|
||||
|
||||
string fn = dir;
|
||||
path_cat(fn, ent->d_name);
|
||||
string fn = path_cat(dir, ent->d_name);
|
||||
|
||||
struct stat st;
|
||||
int statret = stat(fn.c_str(), &st);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user