LLVM API Documentation
00001 //===- llvm/System/Darwin/Path.cpp - Linux Path Implementation --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by Reid Spencer and is distributed under the 00006 // University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file provides the Darwin specific implementation of the Path class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 //===----------------------------------------------------------------------===// 00015 //=== WARNING: Implementation here must contain only Darwin specific code 00016 //=== and must not be generic UNIX code (see ../Unix/Path.cpp) 00017 //===----------------------------------------------------------------------===// 00018 00019 // Include the generic unix implementation 00020 #include "../Unix/Path.cpp" 00021 00022 namespace llvm { 00023 using namespace sys; 00024 00025 bool 00026 Path::isValid() const { 00027 if (path.empty()) 00028 return false; 00029 if (path.length() >= MAXPATHLEN) 00030 return false; 00031 return true; 00032 } 00033 00034 Path 00035 Path::GetTemporaryDirectory() { 00036 char pathname[MAXPATHLEN]; 00037 strcpy(pathname,"/tmp/llvm_XXXXXX"); 00038 if (0 == mkdtemp(pathname)) 00039 ThrowErrno(std::string(pathname) + ": Can't create temporary directory"); 00040 Path result; 00041 result.setDirectory(pathname); 00042 assert(result.isValid() && "mkdtemp didn't create a valid pathname!"); 00043 return result; 00044 } 00045 00046 std::string 00047 Path::GetDLLSuffix() { 00048 return "dylib"; 00049 } 00050 00051 } 00052 00053 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab