summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
authorCharles E. Rolke <chug@apache.org>2013-01-18 20:07:41 +0000
committerCharles E. Rolke <chug@apache.org>2013-01-18 20:07:41 +0000
commitd1a59b99bf1bbefbd1660388a70508d4cafb887d (patch)
treeaac4f20b5534711896fcb7dc041a92949ccf4b0e /qpid/cpp/src
parent6d1404dbd9be680219c02b7f298a4bd0ea883805 (diff)
downloadqpid-python-d1a59b99bf1bbefbd1660388a70508d4cafb887d.tar.gz
QPID-4095: New boost filesystem support. This commit removes the requirement for Boost filesystem in Windows.
The code in FileSysDir that used Boost is rewritten to use simple windows native calls instead. Now Boost filesystem is not used at all. All references in CMakeLists.txt are removed. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1435326 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/CMakeLists.txt20
-rw-r--r--qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp39
2 files changed, 36 insertions, 23 deletions
diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt
index b5c8b319f9..f483a0b9fb 100644
--- a/qpid/cpp/src/CMakeLists.txt
+++ b/qpid/cpp/src/CMakeLists.txt
@@ -306,7 +306,7 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS} ${WARNING_FLAGS}")
# Expand a bit from the basic Find_Boost; be specific about what's needed.
# Boost.system is sometimes needed; it's handled separately, below.
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
- set (Boost_components filesystem program_options date_time thread unit_test_framework regex)
+ set (Boost_components program_options date_time thread unit_test_framework regex)
else (CMAKE_SYSTEM_NAME STREQUAL Windows)
set (Boost_components program_options unit_test_framework)
endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
@@ -316,7 +316,10 @@ endif (CMAKE_SYSTEM_NAME STREQUAL Windows)
# where Boost 1.45 is supported, or we can just accept some versions using
# the Additional_versions variable.
if (NOT DEFINED Boost_ADDITIONAL_VERSIONS)
- set (Boost_ADDITIONAL_VERSIONS "1.45" "1.45.0" "1.46" "1.46.0" "1.47" "1.47.0")
+ set (Boost_ADDITIONAL_VERSIONS
+ "1.45" "1.45.0" "1.46" "1.46.0" "1.47" "1.47.0"
+ "1.48" "1.48.0" "1.49" "1.49.0" "1.50" "1.50.0"
+ "1.51" "1.51.0" "1.52" "1.52.0")
endif (NOT DEFINED Boost_ADDITIONAL_VERSIONS)
find_package(Boost 1.33 REQUIRED COMPONENTS ${Boost_components})
@@ -341,10 +344,6 @@ if (NOT Boost_PROGRAM_OPTIONS_LIBRARY)
set(Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options)
endif (NOT Boost_PROGRAM_OPTIONS_LIBRARY)
-if (NOT Boost_FILESYSTEM_LIBRARY)
- set(Boost_FILESYSTEM_LIBRARY boost_filesystem)
-endif (NOT Boost_FILESYSTEM_LIBRARY)
-
if (NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY boost_unit_test_framework)
endif (NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY)
@@ -370,7 +369,6 @@ option(QPID_LINK_BOOST_DYNAMIC "Link with dynamic Boost libs (OFF to link static
if (MSVC)
install (PROGRAMS
${Boost_DATE_TIME_LIBRARY_DEBUG} ${Boost_DATE_TIME_LIBRARY_RELEASE}
- ${Boost_FILESYSTEM_LIBRARY_DEBUG} ${Boost_FILESYSTEM_LIBRARY_RELEASE}
${Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG} ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE}
${Boost_REGEX_LIBRARY_DEBUG} ${Boost_REGEX_LIBRARY_RELEASE}
${Boost_THREAD_LIBRARY_DEBUG} ${Boost_THREAD_LIBRARY_RELEASE}
@@ -391,10 +389,6 @@ if (MSVC)
string (REPLACE .lib .dll
_boost_date_time_release ${Boost_DATE_TIME_LIBRARY_RELEASE})
string (REPLACE .lib .dll
- _boost_filesystem_debug ${Boost_FILESYSTEM_LIBRARY_DEBUG})
- string (REPLACE .lib .dll
- _boost_filesystem_release ${Boost_FILESYSTEM_LIBRARY_RELEASE})
- string (REPLACE .lib .dll
_boost_program_options_debug ${Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG})
string (REPLACE .lib .dll
_boost_program_options_release ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE})
@@ -417,7 +411,6 @@ if (MSVC)
endif (NOT Boost_VERSION LESS 103500)
install (PROGRAMS
${_boost_date_time_debug} ${_boost_date_time_release}
- ${_boost_filesystem_debug} ${_boost_filesystem_release}
${_boost_program_options_debug} ${_boost_program_options_release}
${_boost_regex_debug} ${_boost_regex_release}
${_boost_system_debug} ${_boost_system_release}
@@ -466,7 +459,6 @@ if (MSVC)
set(Boost_DATE_TIME_LIBRARY "")
set(Boost_THREAD_LIBRARY "")
set(Boost_PROGRAM_OPTIONS_LIBRARY "")
- set(Boost_FILESYSTEM_LIBRARY "")
set(Boost_UNIT_TEST_FRAMEWORK_LIBRARY "")
set(Boost_REGEX_LIBRARY "")
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/windows/resources )
@@ -768,7 +760,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL Windows)
)
set (qpidcommon_platform_LIBS
- ${Boost_THREAD_LIBRARY} ${windows_ssl_libs} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ws2_32 )
+ ${Boost_THREAD_LIBRARY} ${windows_ssl_libs} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_SYSTEM_LIBRARY} ws2_32 )
set (qpidbroker_platform_SOURCES
qpid/broker/windows/BrokerDefaults.cpp
qpid/broker/windows/SaslAuthenticator.cpp
diff --git a/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp b/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp
index 88a2e62acc..e090747715 100644
--- a/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp
+++ b/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp
@@ -24,11 +24,9 @@
#include <sys/stat.h>
#include <direct.h>
#include <errno.h>
+#include <windows.h>
+#include <strsafe.h>
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-
-namespace fs=boost::filesystem;
namespace qpid {
namespace sys {
@@ -56,12 +54,35 @@ void FileSysDir::mkdir(void)
}
void FileSysDir::forEachFile(Callback cb) const {
- fs::directory_iterator dirP(dirPath);
- fs::directory_iterator endItr;
- for (fs::directory_iterator itr (dirP); itr != endItr; ++itr)
- {
- cb(itr->path().string());
+
+ WIN32_FIND_DATAA findFileData;
+ char szDir[MAX_PATH];
+ size_t dirPathLength;
+ HANDLE hFind = INVALID_HANDLE_VALUE;
+
+ // create dirPath+"\*" in szDir
+ StringCchLength (dirPath.c_str(), MAX_PATH, &dirPathLength);
+
+ if (dirPathLength > (MAX_PATH - 3)) {
+ throw Exception ("Directory path is too long: " + dirPath);
}
+
+ StringCchCopy(szDir, MAX_PATH, dirPath.c_str());
+ StringCchCat(szDir, MAX_PATH, TEXT("\\*"));
+
+ // Special work for first file
+ hFind = FindFirstFileA(szDir, &findFileData);
+ if (INVALID_HANDLE_VALUE == hFind) {
+ return;
+ }
+
+ // process everything that isn't a directory
+ do {
+ if (!(findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ std::string fileName(findFileData.cFileName);
+ cb(fileName);
+ }
+ } while (FindNextFile(hFind, &findFileData) != 0);
}
}} // namespace qpid::sys