version 1.44, 2007/02/09 19:22:43
|
version 1.51, 2008/08/07 19:20:42
|
|
|
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
#include <fstream> | #include <fstream> |
#include <cstdio> | #include <cstdio> |
#if defined(PEGASUS_OS_OS400) |
|
#include "EBCDIC_OS400.h" |
|
#endif |
|
#include <Pegasus/Common/Buffer.h> | #include <Pegasus/Common/Buffer.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
*/ | */ |
static Boolean removeFileNoCase(const String& path); | static Boolean removeFileNoCase(const String& path); |
| |
|
/** Produces an array of filenames that match the given pattern under |
|
the directory given by path. The pattern is limited to asterisks |
|
only. Examples: "*.txt", "hello*world.c". Returns true on success. |
|
Return false if the base diretory does not exist or cannot be |
|
accessed. |
|
*/ |
|
static Boolean glob( |
|
const String& path, |
|
const String& pattern, |
|
Array<String>& filenames); |
|
|
/** Loads contents of the file into the array. Note that the file is | /** Loads contents of the file into the array. Note that the file is |
opened using binary mode (newline sequences are not expanded to | opened using binary mode (newline sequences are not expanded to |
carriage-return-line-feed sequences on Windows). | carriage-return-line-feed sequences on Windows). |
|
|
const String& path1, | const String& path1, |
const String& path2); | const String& path2); |
| |
/** Renames a file. |
/** |
@param oldPath old name of file. |
Renames a file. If the new name refers to an existing file, it is |
@param newPath new name of file. |
removed and replaced with the renamed file. The rename operation is |
@return true on success. |
performed atomically. |
|
@param oldPath A String containing the name of the file to rename. |
|
@param newPath A String containing the name to which to rename the file. |
|
@return A Boolean indicating whether the rename operation was |
|
successful. |
*/ | */ |
static Boolean renameFile( | static Boolean renameFile( |
const String& oldPath, | const String& oldPath, |
const String& newPath); | const String& newPath); |
| |
/** Same as rename file except that the case of the file referred to | /** Same as rename file except that the case of the file referred to |
by oldPath is ignored. |
by oldPath is ignored. The case resolution of the oldPath is |
|
performed prior to the atomic rename operation. |
*/ | */ |
static Boolean renameFileNoCase( | static Boolean renameFileNoCase( |
const String& oldPath, | const String& oldPath, |
|
|
*/ | */ |
static String buildLibraryFileName(const String &libraryName); | static String buildLibraryFileName(const String &libraryName); |
| |
|
/** |
|
Returns the platform-specific file name extension for dynamic |
|
libraries. |
|
|
|
@return the platform-specific file name extension for dynamic |
|
libraries. |
|
*/ |
|
static String getDynamicLibraryExtension(); |
|
|
static Boolean changeFileOwner( | static Boolean changeFileOwner( |
const String& fileName, | const String& fileName, |
const String& userName); | const String& userName); |
|
|
| |
@param fstream. The iostream that we want to flush data. | @param fstream. The iostream that we want to flush data. |
*/ | */ |
static void syncWithDirectoryUpdates(fstream&); |
static void syncWithDirectoryUpdates(PEGASUS_STD(fstream)&); |
| |
private: | private: |
| |
|
|
| |
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) |
|
is.open(path.getCString(), PEGASUS_STD(_CCSID_T(1208))); |
|
#else |
|
is.open(path.getCString()); | is.open(path.getCString()); |
#endif |
|
return !!is; | return !!is; |
} | } |
| |
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) |
|
os.open(path.getCString(), PEGASUS_STD(_CCSID_T(1208))); |
|
#else |
|
os.open(path.getCString()); | os.open(path.getCString()); |
#endif |
|
return !!os; | return !!os; |
} | } |
| |
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) |
|
os.open( |
|
path.getCString(), PEGASUS_STD(ios::app), PEGASUS_STD(_CCSID_T(1208))); |
|
#else |
|
os.open(path.getCString(), PEGASUS_STD(ios::app)); | os.open(path.getCString(), PEGASUS_STD(ios::app)); |
#endif |
|
return !!os; | return !!os; |
} | } |
| |