Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What I did:</p> <pre><code>struct vpath_traits; typedef boost::filesystem::basic_path&lt;std::string, vpath_traits&gt; vpath; // utf8 struct vpath_traits { typedef std::string internal_string_type; typedef std::wstring external_string_type; static external_string_type to_external( const vpath &amp;, const internal_string_type &amp;src); static internal_string_type to_internal(const external_string_type &amp;src); }; namespace boost { namespace filesystem { template&lt;&gt; struct is_basic_path&lt;vpath&gt; { BOOST_STATIC_CONSTANT( bool, value = true ); }; } } // convenient functions for converting vpath to and from // whatever API you may be using. std::string vpathToWin32Byte(const vpath &amp;src); vpath vpathFromWin32Byte(const std::string &amp;str); vpath vpathFromWin32Byte(const char *str); std::wstring vpathToWin32Wide(const vpath &amp;src); vpath vpathFromWin32Wide(const std::wstring &amp;str); vpath vpathFromWin32Wide(const wchar_t *str); QDir vpathToQDir(const vpath &amp;src); vpath vpathFromQDir(const QDir &amp;qdir); </code></pre> <p>Note:</p> <p>You must somehow implement the methods <code>vpath_traits::to_external</code> and <code>vpath_traits::to_internal</code>. There are probably some utf8-converter in boost. However I implemented the utf8 to ucs-16 and back myself, but it is neither pretty nor complete, so you are better off using some standard implementation.</p> <p>It works in our code. E g:</p> <pre><code>namespace fs = boost::filesystem; ... vpath dstFile = dstDir / filePath; bool success = true; try { fs::remove(dstFile); } catch (fs::basic_filesystem_error&lt;vpath&gt; &amp; /* e */) { success = false;} if (success) { try { fs::copy_file(srcFile, dstFile); } catch (fs::basic_filesystem_error&lt;vpath&gt; &amp; /* e */) { success = false;} } ... </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload