Skip to content

Commit 5d0117d

Browse files
committed
Port to boost::filesystem3 from boost::filesystem2
The major change is that filesystem3 has only one 'path' type (not wide- or narrow-character variations). Since LucenePlusPlus isolates boost::filesystem interaction in FileUtils, the changes are minor and easy to manage.
1 parent 88c8f7b commit 5d0117d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

include/Config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@
8888
#define BOOST_DYNAMIC_BITSET_DONT_USE_FRIENDS
8989

9090
// Force boost file-system version 2 for later boost versions > 1.46
91-
#define BOOST_FILESYSTEM_VERSION 2
91+
#define BOOST_FILESYSTEM_VERSION 3
9292

9393
#endif

src/core/util/FileUtils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ namespace Lucene
164164
{
165165
try
166166
{
167-
for (boost::filesystem::wdirectory_iterator dir(path.c_str()); dir != boost::filesystem::wdirectory_iterator(); ++dir)
167+
for (boost::filesystem::directory_iterator dir(path.c_str()); dir != boost::filesystem::directory_iterator(); ++dir)
168168
{
169169
if (!filesOnly || !boost::filesystem::is_directory(dir->status()))
170-
dirList.add(dir->path().filename().c_str());
170+
dirList.add(dir->path().filename().wstring().c_str());
171171
}
172172
return true;
173173
}
@@ -202,9 +202,9 @@ namespace Lucene
202202
{
203203
try
204204
{
205-
boost::filesystem::wpath join(path.c_str());
205+
boost::filesystem::path join(path.c_str());
206206
join /= file.c_str();
207-
return join.directory_string().c_str();
207+
return join.wstring().c_str();
208208
}
209209
catch (...)
210210
{
@@ -217,7 +217,7 @@ namespace Lucene
217217
try
218218
{
219219
boost::filesystem::wpath parentPath(path.c_str());
220-
return parentPath.parent_path().directory_string().c_str();
220+
return parentPath.parent_path().wstring().c_str();
221221
}
222222
catch (...)
223223
{
@@ -230,7 +230,7 @@ namespace Lucene
230230
try
231231
{
232232
boost::filesystem::wpath fileName(path.c_str());
233-
return fileName.filename().c_str();
233+
return fileName.filename().wstring().c_str();
234234
}
235235
catch (...)
236236
{

0 commit comments

Comments
 (0)