2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
5 * See wvsyncfilelister.h for details.
9 #include "wvsyncfilelister.h"
10 #include "wvsyncprotocol.h"
12 WvSyncFileLister::WvSyncFileLister(WvSyncProtocol
&_prot
,
13 WvStringParm _rootdir
, UniConf _root
)
14 : WvSyncLister(_prot
),
15 log("FileLister", WvLog::Debug1
),
16 err(log
.split(WvLog::Error
)),
22 log(WvLog::Debug3
, "FileLister created on %s\n", rootdir
);
28 WvSyncObj
*WvSyncFileLister::next()
32 if (curdir
!= prot
.getcwd())
40 // Get the current reldir
41 WvString reldir
= i
->relname
;
42 reldir
.edit()[strlen(i
->relname
)-strlen(i
->name
)] = '\0';
43 int n
= strlen(reldir
);
44 while (reldir
[--n
] == '/')
45 reldir
.edit()[n
] = '\0';
49 if (prot
.getcwd() != reldir
)
56 // FIXME: do we leak this?
57 return new WvSyncFile(i
->relname
, rootdir
);
61 WvSyncObj
*WvSyncFileLister::makeobj(WvStringParm name
)
63 // FIXME: do we leak this?
64 return new WvSyncFile(name
, rootdir
);
68 bool WvSyncFileLister::newcwd(WvStringParm dir
)
71 log(WvLog::Debug3
, "WvSyncFileLister::newcwd got dir:%s\n", dir
);