version 1.19, 2002/06/01 00:56:31
|
version 1.24.2.1, 2002/10/28 15:43:21
|
|
|
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
#include <Pegasus/Common/Array.h> | #include <Pegasus/Common/Array.h> |
#include <Pegasus/Common/Exception.h> | #include <Pegasus/Common/Exception.h> |
|
#include <Pegasus/Common/Linkage.h> |
#include <fstream> | #include <fstream> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
*/ | */ |
static void translateSlashes(String& path); | static void translateSlashes(String& path); |
| |
|
/** Get an absolute path from an absolute directory and a relative or |
|
absolute file name. If the file name is fully specified, it is |
|
returned unchanged. Otherwise, the specified directory is prepended |
|
to the file name. |
|
*/ |
|
static String getAbsolutePath(const char* path, const String& filename); |
|
|
private: | private: |
| |
FileSystem() { } | FileSystem() { } |
|
|
return FileSystem::getFileSize(realPath, size); | return FileSystem::getFileSize(realPath, size); |
} | } |
| |
|
inline String FileSystem::getAbsolutePath( |
|
const char* path, |
|
const String& filename) |
|
{ |
|
String absolutePath; |
|
|
|
if (filename != String::EMPTY) |
|
{ |
|
if ((filename[0] != '/') && path && path[0]) |
|
{ |
|
absolutePath.append(path); |
|
absolutePath.append('/'); |
|
} |
|
absolutePath.append(filename); |
|
} |
|
translateSlashes(absolutePath); |
|
|
|
return absolutePath; |
|
} |
|
|
inline Boolean Open(PEGASUS_STD(ifstream)& is, const String& path) | inline Boolean Open(PEGASUS_STD(ifstream)& is, const String& path) |
{ | { |
char* tmpPath = path.allocateCString(); | char* tmpPath = path.allocateCString(); |