1 //===- Cygwin/Path.cpp - Cygwin Path Implementation -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides the Cygwin specific implementation of the Path class.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 //=== WARNING: Implementation here must contain only Cygwin specific code
16 //=== and must not be generic UNIX code (see ../Unix/Path.cpp)
17 //===----------------------------------------------------------------------===//
19 // Include the generic Unix implementation
20 #include "../Unix/Path.cpp"
26 Path::is_valid() const {
29 char pathname[MAXPATHLEN];
30 if (0 == realpath(path.c_str(), pathname))
31 if (errno != EACCES && errno != EIO && errno != ENOENT && errno != ENOTDIR)
37 Path::GetTemporaryDirectory() {
38 char* pathname = tempnam(0,"llvm_");
40 ThrowErrno(std::string("Can't create temporary directory name"));
42 result.set_directory(pathname);
44 assert(result.is_valid() && "tempnam didn't create a valid pathname!");
45 if (0 != mkdir(result.c_str(), S_IRWXU))
46 ThrowErrno(result.get() + ": Can't create temporary directory");
51 Path::GetDLLSuffix() {
57 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab