You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ch...@apache.org on 2013/01/18 21:07:41 UTC
svn commit: r1435326 - in /qpid/trunk/qpid/cpp/src: CMakeLists.txt
qpid/sys/windows/FileSysDir.cpp
Author: chug
Date: Fri Jan 18 20:07:41 2013
New Revision: 1435326
URL: http://svn.apache.org/viewvc?rev=1435326&view=rev
Log:
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.
Modified:
qpid/trunk/qpid/cpp/src/CMakeLists.txt
qpid/trunk/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp
Modified: qpid/trunk/qpid/cpp/src/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/CMakeLists.txt?rev=1435326&r1=1435325&r2=1435326&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/CMakeLists.txt (original)
+++ qpid/trunk/qpid/cpp/src/CMakeLists.txt Fri Jan 18 20:07:41 2013
@@ -306,7 +306,7 @@ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_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 Window
# 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 wit
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
Modified: qpid/trunk/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp?rev=1435326&r1=1435325&r2=1435326&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/sys/windows/FileSysDir.cpp Fri Jan 18 20:07:41 2013
@@ -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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org