Boost logo

Boost Users :

Subject: [Boost-users] Apology: RE: FileSystem: crash on OSX 10.8 with create_directory
From: Tim Burgess (tim_at_[hidden])
Date: 2014-02-08 13:14:32


Hi,

 

I must apologise for the stupidity of this question - if I'd have surrounded
the call with a try/catch block I'd have figured it out sooner, so it's my
own bad coding.

 

Now all I need to figure out is how to programmatically create a directory
with admin rights to get around the permission denied exception when trying
to create files/directories within /library/application support/ on the Mac.

 

Best wishes.

Tim Burgess

 

From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
Tim Burgess
Sent: 07 February 2014 16:32
To: boost-users list
Subject: [Boost-users] FileSystem: crash on OSX 10.8 with create_directory

 

Hi,

 

My app crashes out when I run the following:

 

                                boost::filesystem::path myPath =
wxStandardPaths::Get().GetConfigDir().ToStdWstring();

                

                                if (myPath.has_filename())

                {

                                myPath.remove_filename();

                }

 

// Add the company name and check for directory existence

                myPath /=wstrRBCompanyName;

                

                if (!boost::filesystem::exists(myPath))

                {

// The following test displays the path I'd expect to see (/library/Raised
Bar in my case)

                                wxMessageBox( myPath.native(),
wstrErrorTitle, wxOK | wxICON_EXCLAMATION);

                                // Create the required directory - displays
a message box indicating deletion of a lock file here and the app exits

                                boost::filesystem::create_directory(myPath);

                }

This code appears to work fine on Windows, but fails on OSX 10.8. I should
point out that I'm a blind programmer and I'm struggling to get Apple's
VoiceOver utility to interact in a useful manner with Xcode 5's debugger and
that's why I'm using a wxMessageBox to try and track down my failure.

 

Best wishes.

 

Tim

 



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net