void MCLDDirectory::setSysroot(const sys::fs::Path& pSysroot) {
  if (m_bInSysroot) {
    std::string old_path = Directory::m_Path.native();
    Directory::m_Path.native() = pSysroot.native();
    Directory::m_Path.m_append_separator_if_needed();
    Directory::m_Path.native() += old_path;
    detail::canonicalize(Directory::m_Path.native());
    detail::open_dir(*this);
  }
}
//===----------------------------------------------------------------------===//
// ToolOutputFile
//===----------------------------------------------------------------------===//
ToolOutputFile::ToolOutputFile(const sys::fs::Path& pPath,
                               FileHandle::OpenMode pMode,
                               FileHandle::Permission pPermission)
  : m_Installer(pPath.native()),
    m_pMemoryArea(NULL),
    m_pOStream(NULL),
    m_pFOStream(NULL) {

  if (!m_FileHandle.open(pPath, pMode, pPermission)) {
    // If open fails, no clean-up is needed.
    m_Installer.Keep = true;
    fatal(diag::err_cannot_open_output_file)
                                   << pPath
                                   << sys::strerror(m_FileHandle.error());
    return;
  }

  m_pMemoryArea = new MemoryArea(m_FileHandle);
  m_pOStream = new raw_mem_ostream(*m_pMemoryArea);
}
bool SearchDirs::insert(const sys::fs::Path& pPath)
{
  return insert(pPath.native());
}