delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/10/10/16:59:10

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <434AD617.2090700@princeton.edu>
Date: Mon, 10 Oct 2005 16:59:03 -0400
From: Lewis Hyatt <lhyatt AT Princeton DOT EDU>
User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: problem with boost 1.33 filesystem

Hi All,

I apologize if this has been brought up before, but I couldn't find any 
mention of it. I think the filesystem component of boost v1.33 currently 
available as part of the cygwin distribution has been compiled 
incorrectly. As mentioned here: 
http://boost.org/libs/filesystem/doc/index.htm#Cgywin (sic), it is 
necessary to compile with -DBOOST_POSIX on cygwin for POSIX emulation to 
work properly; otherwise it uses Windows file names only and does not 
work as expected. Here is a simple demonstration:

////////////////////////////
#include <iostream>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/exception.hpp>
namespace bfs = boost::filesystem;

int main(int argc, char **argv)	{
	//arg checking omitted
	try	{
		bfs::directory_iterator di(argv[1]);
	}
	catch (bfs::filesystem_error &ex)	{
		std::cerr << ex.what() << '\n';
	}
}
////////////////////////////

If you pass something Windows can handle as the argument, such as ".", 
then this program works as expected. If you pass a cygwin path, such
as "~" or "/cygdrive/c", it throws an exception:

boost::filesystem::directory_iterator constructor: "\home\Lewis": The 
system cannot find the path specified.

or

boost::filesystem::directory_iterator constructor: "\cygdrive\c": The 
system cannot find the path specified.

I believe this is precisely the consequence of omitting -DBOOST_POSIX 
but cannot confirm with certainty.

Thanks very much to whoever maintains this.

-Lewis

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019