You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by pa...@apache.org on 2001/02/05 21:50:43 UTC

cvs commit: xml-xalan/c/src/PlatformSupport DirectoryEnumerator.hpp

pauldick    01/02/05 12:50:43

  Modified:    c/src/PlatformSupport DirectoryEnumerator.hpp
  Log:
  Added code to filter out the parent, self and CVS directories, i.e. ".", "..", "CVS".
  
  Revision  Changes    Path
  1.17      +12 -5     xml-xalan/c/src/PlatformSupport/DirectoryEnumerator.hpp
  
  Index: DirectoryEnumerator.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DirectoryEnumerator.hpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DirectoryEnumerator.hpp	2001/01/25 20:02:27	1.16
  +++ DirectoryEnumerator.hpp	2001/02/05 20:50:43	1.17
  @@ -103,7 +103,7 @@
   	 *
   	 * @return file name
   	 */
  -	const XalanDOMChar*
  +	const XalanDOMString
   	getName() const
   	{
   		return name;
  @@ -163,10 +163,19 @@
   struct DirectoryFilterPredicate : public std::unary_function<FindFileStruct, bool>
   #endif
   {
  +	// This function will filter out the parent, self and CVS directories, i.e.
  +	// ".", "..", "CVS".
   	result_type
   	operator()(const argument_type&	theFindData) const
   	{
  -		return theFindData.isDirectory();
  +		const XalanDOMString	current(XALAN_STATIC_UCODE_STRING("."));
  +		const XalanDOMString	parent(XALAN_STATIC_UCODE_STRING(".."));
  +		const XalanDOMString	cvs(XALAN_STATIC_UCODE_STRING("CVS"));
  +		
  +		const XalanDOMString	dirName=theFindData.getName();
  +
  +		return theFindData.isDirectory() && (!equals(dirName, cvs) && !equals(dirName, current) && !equals(dirName, parent));
  +
   	}
   };
   
  @@ -189,7 +198,6 @@
   };
   
   
  -
   template<class OutputIteratorType,
   		 class FilterPredicateType,
   		 class StringType,
  @@ -218,8 +226,7 @@
   					*theOutputIterator = StringType(theFindData.getName());
   				}
   			}
  -			while(_wfindnext(theSearchHandle,
  -							 &theFindData) == 0);
  +			while(_wfindnext(theSearchHandle, &theFindData) == 0);
   		}
   		catch(...)
   		{