$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r72306 - in trunk/libs/filesystem/v3: doc example test test/msvc10 test/msvc10/file_status
From: bdawes_at_[hidden]
Date: 2011-05-31 09:44:27
Author: bemandawes
Date: 2011-05-31 09:44:26 EDT (Tue, 31 May 2011)
New Revision: 72306
URL: http://svn.boost.org/trac/boost/changeset/72306
Log:
Add example file_status.cpp
Added:
   trunk/libs/filesystem/v3/example/file_status.cpp   (contents, props changed)
   trunk/libs/filesystem/v3/test/msvc10/file_status/
   trunk/libs/filesystem/v3/test/msvc10/file_status/file_status.vcxproj   (contents, props changed)
Text files modified: 
   trunk/libs/filesystem/v3/doc/release_history.html      |    12 +++++++++++-                            
   trunk/libs/filesystem/v3/example/Jamfile.v2            |     5 ++++-                                   
   trunk/libs/filesystem/v3/test/Jamfile.v2               |     1 +                                       
   trunk/libs/filesystem/v3/test/msvc10/filesystem-v3.sln |    10 ++++++++++                              
   4 files changed, 26 insertions(+), 2 deletions(-)
Modified: trunk/libs/filesystem/v3/doc/release_history.html
==============================================================================
--- trunk/libs/filesystem/v3/doc/release_history.html	(original)
+++ trunk/libs/filesystem/v3/doc/release_history.html	2011-05-31 09:44:26 EDT (Tue, 31 May 2011)
@@ -36,6 +36,16 @@
   </tr>
 </table>
 
+<h2>1.47.0</h2>
+<ul>
+  <li>Program file_status.cpp added (V3). See boost-root/libs/filesystem/v3/example. 
+  Useful both as an example and to explore how Boost.Filesystem treats various 
+  status errors.  Run "bjam" (NOT "bjam install") in the example directory 
+  to install in example/bin.</li>
+</ul>
+
+<h2>1.46.1</h2>
+
 <h2>1.46.0</h2>
 <ul>
   <li>Version 3 of the library is now the default.</li>
@@ -58,7 +68,7 @@
 </ul>
 <hr>
 <p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->20 February, 2011<!--webbot bot="Timestamp" endspan i-checksum="40524" --></p>
+<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->31 May, 2011<!--webbot bot="Timestamp" endspan i-checksum="13963" --></p>
 <p>© Copyright Beman Dawes, 2011</p>
 <p> Use, modification, and distribution are subject to the Boost Software 
 License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">
Modified: trunk/libs/filesystem/v3/example/Jamfile.v2
==============================================================================
--- trunk/libs/filesystem/v3/example/Jamfile.v2	(original)
+++ trunk/libs/filesystem/v3/example/Jamfile.v2	2011-05-31 09:44:26 EDT (Tue, 31 May 2011)
@@ -21,4 +21,7 @@
 exe tut3 : tut3.cpp ;
 exe tut4 : tut4.cpp ;
 exe tut5 : tut5.cpp ;
-exe path_info : path_info.cpp ;    
+exe path_info : path_info.cpp ;
+exe file_status : file_status.cpp ;
+
+install bin : file_status ;    #invoke via "bjam", not "bjam install"
Added: trunk/libs/filesystem/v3/example/file_status.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/filesystem/v3/example/file_status.cpp	2011-05-31 09:44:26 EDT (Tue, 31 May 2011)
@@ -0,0 +1,101 @@
+//  status.cpp  ------------------------------------------------------------------------//
+
+//  Copyright Beman Dawes 2011
+
+//  Distributed under the Boost Software License, Version 1.0.
+//  See http://www.boost.org/LICENSE_1_0.txt
+
+//  Library home page: http://www.boost.org/libs/filesystem
+
+#include <iostream>
+#include <boost/config.hpp>
+#include <boost/version.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/detail/lightweight_main.hpp>
+
+using std::cout; using std::endl;
+using namespace boost::filesystem;
+
+namespace
+{
+  path p;
+  
+  void print_boost_macros()
+  {
+    std::cout << "Boost "
+              << BOOST_VERSION / 100000 << '.'
+              << BOOST_VERSION / 100 % 1000 << '.'
+              << BOOST_VERSION % 100 << ", "
+#           ifndef _WIN64
+              << BOOST_COMPILER << ", "
+#           else
+              << BOOST_COMPILER << " with _WIN64 defined, "
+#           endif
+              << BOOST_STDLIB << ", "
+              << BOOST_PLATFORM
+              << std::endl;
+  }
+
+  const char* file_type_tab[] = 
+    { "status_error", "file_not_found", "regular_file", "directory_file",
+      "symlink_file", "block_file", "character_file", "fifo_file", "socket_file",
+      "type_unknown"
+    };
+
+  const char* file_type_c_str(enum file_type t)
+  {
+    return file_type_tab[t];
+  }
+
+  void show_status(file_status s, boost::system::error_code ec)
+  {
+    boost::system::error_condition econd;
+
+    if (ec)
+    {
+      econd = ec.default_error_condition();
+      cout << "sets ec to indicate an error:\n"
+           << "   ec.value() is " << ec.value() << '\n'
+           << "   ec.message() is \"" << ec.message() << "\"\n"
+           << "   ec.default_error_condition().value() is " << econd.value() << '\n'
+           << "   ec.default_error_condition().message() is \"" << econd.message() << "\"\n";
+    }
+    else
+      cout << "clears ec.\n";
+
+    cout << "s.type() is " << s.type()
+         << ", which is defined as \"" << file_type_c_str(s.type()) << "\"\n";
+
+    cout << "exists(s) is " << (exists(s) ? "true" : "false") << "\n";
+    cout << "status_known(s) is " << (status_known(s) ? "true" : "false") << "\n";
+    cout << "is_regular_file(s) is " << (is_regular_file(s) ? "true" : "false") << "\n";
+    cout << "is_directory(s) is " << (is_directory(s) ? "true" : "false") << "\n";
+    cout << "is_other(s) is " << (is_other(s) ? "true" : "false") << "\n";
+    cout << "is_symlink(s) is " << (is_symlink(s) ? "true" : "false") << "\n";
+  }
+
+}
+
+int cpp_main(int argc, char* argv[])
+{
+  print_boost_macros();
+
+  if (argc < 2)
+  {
+    std::cout << "Usage: file_status <path>\n";
+    p = argv[0];
+  }
+  else
+    p = argv[1];
+
+  boost::system::error_code ec;
+  file_status s = status(p, ec);
+  cout << "\nfile_status s = status(" << p << ", ec) ";
+  show_status(s, ec);
+
+  s = symlink_status(p, ec);
+  cout << "\nfile_status s = symlink_status(" << p << ", ec) ";
+  show_status(s, ec);
+
+  return 0;
+}
Modified: trunk/libs/filesystem/v3/test/Jamfile.v2
==============================================================================
--- trunk/libs/filesystem/v3/test/Jamfile.v2	(original)
+++ trunk/libs/filesystem/v3/test/Jamfile.v2	2011-05-31 09:44:26 EDT (Tue, 31 May 2011)
@@ -28,6 +28,7 @@
        [ run large_file_support_test.cpp ]
        [ run deprecated_test.cpp ]                  
        [ run ../example/simple_ls.cpp ]
+       [ run ../example/file_status.cpp ]
  
 #       [ compile ../example/mbcopy.cpp ]
 #       [ compile ../example/mbpath.cpp ]
Added: trunk/libs/filesystem/v3/test/msvc10/file_status/file_status.vcxproj
==============================================================================
--- (empty file)
+++ trunk/libs/filesystem/v3/test/msvc10/file_status/file_status.vcxproj	2011-05-31 09:44:26 EDT (Tue, 31 May 2011)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>file_status</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="..\common.props" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+    <Import Project="..\common.props" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <PostBuildEvent>
+      <Command>"$(TargetDir)\$(TargetName).exe"</Command>
+      <Message>Executing test $(TargetName).exe...</Message>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <PostBuildEvent>
+      <Command>"$(TargetDir)\$(TargetName).exe"</Command>
+      <Message>Executing test $(TargetName).exe...</Message>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\..\..\example\file_status.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\filesystem_dll\filesystem_dll.vcxproj">
+      <Project>{ffd738f7-96f0-445c-81ea-551665ef53d1}</Project>
+    </ProjectReference>
+    <ProjectReference Include="..\system_dll\system_dll.vcxproj">
+      <Project>{f94ccadd-a90b-480c-a304-c19d015d36b1}</Project>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
Modified: trunk/libs/filesystem/v3/test/msvc10/filesystem-v3.sln
==============================================================================
--- trunk/libs/filesystem/v3/test/msvc10/filesystem-v3.sln	(original)
+++ trunk/libs/filesystem/v3/test/msvc10/filesystem-v3.sln	2011-05-31 09:44:26 EDT (Tue, 31 May 2011)
@@ -71,6 +71,12 @@
                 {FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
         EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "file_status", "file_status\file_status.vcxproj", "{43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}"
+	ProjectSection(ProjectDependencies) = postProject
+		{F94CCADD-A90B-480C-A304-C19D015D36B1} = {F94CCADD-A90B-480C-A304-C19D015D36B1}
+		{FFD738F7-96F0-445C-81EA-551665EF53D1} = {FFD738F7-96F0-445C-81EA-551665EF53D1}
+	EndProjectSection
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -158,6 +164,10 @@
                 {1A6A7DAF-8705-4B2B-83B5-93F84A63496C}.Debug|Win32.Build.0 = Debug|Win32
                 {1A6A7DAF-8705-4B2B-83B5-93F84A63496C}.Release|Win32.ActiveCfg = Release|Win32
                 {1A6A7DAF-8705-4B2B-83B5-93F84A63496C}.Release|Win32.Build.0 = Release|Win32
+		{43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}.Debug|Win32.ActiveCfg = Debug|Win32
+		{43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}.Debug|Win32.Build.0 = Debug|Win32
+		{43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}.Release|Win32.ActiveCfg = Release|Win32
+		{43C4B4D8-0893-4C86-B9FD-6A7DEB1A4426}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE