Home | History | Annotate | Download | only in Support
      1 //===- FileSystem.cpp -----------------------------------------------------===//
      2 //
      3 //                     The MCLinker Project
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 #include <mcld/Config/Config.h>
     10 #include <mcld/Support/FileSystem.h>
     11 #include <mcld/Support/Path.h>
     12 
     13 //===----------------------------------------------------------------------===//
     14 // non-member functions
     15 //===----------------------------------------------------------------------===//
     16 bool mcld::sys::fs::exists(const Path &pPath)
     17 {
     18   mcld::sys::fs::FileStatus file_status;
     19   mcld::sys::fs::detail::status(pPath, file_status);
     20   return (file_status.type() != mcld::sys::fs::StatusError) &&
     21          (file_status.type() != mcld::sys::fs::FileNotFound);
     22 }
     23 
     24 bool mcld::sys::fs::is_directory(const Path &pPath)
     25 {
     26   FileStatus file_status;
     27   detail::status(pPath, file_status);
     28   return (file_status.type() == mcld::sys::fs::DirectoryFile);
     29 }
     30 
     31 // Include the truly platform-specific parts.
     32 #if defined(MCLD_ON_UNIX)
     33 #include "Unix/FileSystem.inc"
     34 #include "Unix/PathV3.inc"
     35 #endif
     36 #if defined(MCLD_ON_WIN32)
     37 #include "Windows/FileSystem.inc"
     38 #include "Windows/PathV3.inc"
     39 #endif
     40