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//===----------------------------------------------------------------------===// 16bool mcld::sys::fs::exists(const Path& pPath) { 17 mcld::sys::fs::FileStatus file_status; 18 mcld::sys::fs::detail::status(pPath, file_status); 19 return (file_status.type() != mcld::sys::fs::StatusError) && 20 (file_status.type() != mcld::sys::fs::FileNotFound); 21} 22 23bool mcld::sys::fs::is_directory(const Path& pPath) { 24 FileStatus file_status; 25 detail::status(pPath, file_status); 26 return (file_status.type() == mcld::sys::fs::DirectoryFile); 27} 28 29// Include the truly platform-specific parts. 30#if defined(MCLD_ON_UNIX) 31#include "Unix/FileSystem.inc" 32#include "Unix/PathV3.inc" 33#endif 34#if defined(MCLD_ON_WIN32) 35#include "Windows/FileSystem.inc" 36#include "Windows/PathV3.inc" 37#endif 38