version 1.28, 2003/08/12 19:37:55
|
version 1.33, 2004/08/26 03:23:14
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2003//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L. P., IBM Corp., The Open Group, Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: |
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
*/ | */ |
static String extractFilePath(const String& path); | static String extractFilePath(const String& path); |
| |
|
/** Changes file permissions on the given file. |
|
@param path path of the file. |
|
@param mode the bit-wise inclusive OR of the values for the |
|
desired permissions. |
|
@return true on success, false on error and errno is set appropriately. |
|
*/ |
|
static Boolean changeFilePermissions(const String& path, mode_t mode); |
|
|
|
/** |
|
Return OS path specific delimiter. |
|
|
|
@return delimiter specific to the platform |
|
*/ |
|
static String getPathDelimiter(); |
|
|
|
/** |
|
Returns the absolute pathname for the specified filename. |
|
|
|
@param paths directories seperated by an OS specific delimiter to search |
|
@param filename filename to search for in the paths |
|
|
|
@return the full absolute pathname to the found filename or an empty |
|
string on failure. |
|
*/ |
|
static String getAbsoluteFileName(const String &paths, const String &filename); |
|
|
|
/** |
|
Convert a library name to its corresponding file name by adding the |
|
appropriate prefix and suffix. |
|
|
|
@param libraryName The name of the library for which to build the file |
|
name. |
|
@return The file name corresponding to the specified library name. |
|
*/ |
|
static String buildLibraryFileName(const String &libraryName); |
|
|
private: | private: |
| |
FileSystem() { } | FileSystem() { } |
|
|
inline Boolean Open(PEGASUS_STD(ifstream)& is, const String& path) | inline Boolean Open(PEGASUS_STD(ifstream)& is, const String& path) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
CString tempPath = path.getCString(); |
is.open(path.getCString(), PEGASUS_STD(_CCSID_T(1208))); |
const char * tmp = tempPath; |
|
AtoE((char *)tmp); |
|
is.open(tmp, PEGASUS_STD(_CCSID_T(1208))); |
|
#else | #else |
is.open(path.getCString()); | is.open(path.getCString()); |
#endif | #endif |
|
|
inline Boolean Open(PEGASUS_STD(ofstream)& os, const String& path) | inline Boolean Open(PEGASUS_STD(ofstream)& os, const String& path) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
CString tempPath = path.getCString(); |
os.open(path.getCString(), PEGASUS_STD(_CCSID_T(1208))); |
const char * tmp = tempPath; |
|
AtoE((char *)tmp); |
|
os.open(tmp, PEGASUS_STD(_CCSID_T(1208))); |
|
#else | #else |
os.open(path.getCString()); | os.open(path.getCString()); |
#endif | #endif |
|
|
inline Boolean OpenAppend(PEGASUS_STD(ofstream)& os, const String& path) | inline Boolean OpenAppend(PEGASUS_STD(ofstream)& os, const String& path) |
{ | { |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
CString tempPath = path.getCString(); |
os.open(path.getCString(), PEGASUS_STD(ios::app), PEGASUS_STD(_CCSID_T(1208))); |
const char * tmp = tempPath; |
|
AtoE((char *)tmp); |
|
os.open(tmp, PEGASUS_STD(ios::app), PEGASUS_STD(_CCSID_T(1208))); |
|
#else | #else |
os.open(path.getCString(), PEGASUS_STD(ios::app)); | os.open(path.getCString(), PEGASUS_STD(ios::app)); |
#endif | #endif |
return !!os; | return !!os; |
} | } |
| |
|
inline String FileSystem::getPathDelimiter() |
|
{ |
|
#if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) |
|
return String(";"); |
|
#else |
|
return String(":"); |
|
#endif |
|
} |
|
|
/** Get the next line from the input file. | /** Get the next line from the input file. |
*/ | */ |
PEGASUS_COMMON_LINKAGE Boolean GetLine(PEGASUS_STD(istream)& is, String& line); | PEGASUS_COMMON_LINKAGE Boolean GetLine(PEGASUS_STD(istream)& is, String& line); |