version 1.15.2.1, 2001/10/10 15:39:06
|
version 1.19, 2002/06/01 00:56:31
|
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
|
// The Open Group, Tivoli Systems |
// | // |
// 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 |
|
|
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 |
|
by oldPath is ignored. |
|
*/ |
|
static Boolean renameFileNoCase( |
|
const String& oldPath, |
|
const String& newPath); |
|
|
|
/** Copy a file. |
|
@param fromPath name of existing file. |
|
@param toPath name of new file. |
|
@return true on success. |
|
*/ |
|
static Boolean copyFile( |
|
const String& fromPath, |
|
const String& toPath); |
|
|
/** Opens a file and ignores the case of the file. Note that the file | /** Opens a file and ignores the case of the file. Note that the file |
will be opend in binary mode (no translation of carriage-return-line- | will be opend in binary mode (no translation of carriage-return-line- |
feed sequences on Windows). | feed sequences on Windows). |
|
|
@param path path of file to be opened. | @param path path of file to be opened. |
@return true on success. | @return true on success. |
*/ | */ |
Boolean openNoCase(PEGASUS_STD(ifstream)& is, const String& path); |
static Boolean openNoCase(PEGASUS_STD(ifstream)& is, const String& path); |
|
|
|
/** Opens a file and ignores the case of the file. Note that the file |
|
open mode of the file must be passed in. |
|
@param os file stream to be opend. |
|
@param path path of file to be opened. |
|
@param mode mode to open the file in. |
|
@return true on success. |
|
*/ |
|
static Boolean openNoCase( |
|
PEGASUS_STD(fstream)& fs, |
|
const String& path, |
|
int mode); |
| |
/** Determines whether the path refers to a directory. | /** Determines whether the path refers to a directory. |
@param path path of the directory. | @param path path of the directory. |
|
|
return FileSystem::removeFile(realPath); | return FileSystem::removeFile(realPath); |
} | } |
| |
|
inline Boolean FileSystem::renameFileNoCase( |
|
const String& oldPath, |
|
const String& newPath) |
|
{ |
|
String realPath; |
|
|
|
if (!existsNoCase(oldPath, realPath)) |
|
return false; |
|
|
|
return FileSystem::renameFile(realPath, newPath); |
|
} |
|
|
inline Boolean FileSystem::getFileSizeNoCase(const String& path, Uint32& size) | inline Boolean FileSystem::getFileSizeNoCase(const String& path, Uint32& size) |
{ | { |
String realPath; | String realPath; |
|
|
return FileSystem::getFileSize(realPath, size); | return FileSystem::getFileSize(realPath, size); |
} | } |
| |
|
inline Boolean Open(PEGASUS_STD(ifstream)& is, const String& path) |
|
{ |
|
char* tmpPath = path.allocateCString(); |
|
is.open(tmpPath); |
|
delete [] tmpPath; |
|
return !!is; |
|
} |
|
|
|
inline Boolean Open(PEGASUS_STD(ofstream)& os, const String& path) |
|
{ |
|
char* tmpPath = path.allocateCString(); |
|
os.open(tmpPath); |
|
delete [] tmpPath; |
|
return !!os; |
|
} |
|
|
|
inline Boolean OpenAppend(PEGASUS_STD(ofstream)& os, const String& path) |
|
{ |
|
char* tmpPath = path.allocateCString(); |
|
os.open(tmpPath, PEGASUS_STD(ios::app)); |
|
delete [] tmpPath; |
|
return !!os; |
|
} |
|
|
|
/** Get the next line from the input file. |
|
*/ |
|
PEGASUS_COMMON_LINKAGE Boolean GetLine(PEGASUS_STD(istream)& is, String& line); |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
#endif /* Pegasus_FileSystem_h */ | #endif /* Pegasus_FileSystem_h */ |