1 //===-- Path.cpp - Implement OS Path Concept --------------------*- 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 header file implements the operating system Path concept.
12 //===----------------------------------------------------------------------===//
13 #include "llvm/System/Path.h"
18 //===----------------------------------------------------------------------===//
19 //=== WARNING: Implementation here must contain only TRULY operating system
20 //=== independent code.
21 //===----------------------------------------------------------------------===//
24 Path::is_valid() const {
25 if ( empty() ) return false;
30 Path::fill( char* buffer, unsigned bufflen ) const {
31 unsigned pathlen = length();
32 assert( bufflen > pathlen && "Insufficient buffer size" );
33 unsigned copylen = pathlen <? (bufflen - 1);
34 this->copy(buffer, copylen, 0 );
35 buffer[ copylen ] = 0;
39 Path::make_directory() {
45 else if ( (*this)[length()-1] != '/')
51 if ( (*this)[length()-1] == '/')
52 this->erase( this->length()-1, 1 );
55 // Include the truly platform-specific parts of this class.
56 #include "platform/Path.cpp"