| //===- Support/PlatformUtility.cpp - Platform Specific Utilities ----------===// |
| // |
| // The LLVM Compiler Infrastructure |
| // |
| // This file is distributed under the University of Illinois Open Source |
| // License. See LICENSE.TXT for details. |
| // |
| //===----------------------------------------------------------------------===// |
| |
| #include "llbuild/Basic/PlatformUtility.h" |
| |
| #if defined(_WIN32) |
| #include "LeanWindows.h" |
| #include <io.h> |
| #else |
| #include <stdio.h> |
| #include <unistd.h> |
| #endif |
| |
| using namespace llbuild; |
| using namespace llbuild::basic; |
| |
| bool sys::chdir(const char* fileName) { |
| #if defined(_WIN32) |
| return SetCurrentDirectoryA(fileName); |
| #else |
| return ::chdir(fileName) == 0; |
| #endif |
| } |
| |
| int sys::pclose(FILE *stream) { |
| #if defined(_WIN32) |
| return ::_pclose(stream); |
| #else |
| return ::pclose(stream); |
| #endif |
| } |
| |
| FILE *sys::popen(const char *command, const char *mode) { |
| #if defined(_WIN32) |
| return ::_popen(command, mode); |
| #else |
| return ::popen(command, mode); |
| #endif |
| } |
| |
| int sys::unlink(const char *fileName) { |
| #if defined(_WIN32) |
| return ::_unlink(fileName); |
| #else |
| return ::unlink(fileName); |
| #endif |
| } |