version 1.40, 2002/09/11 19:11:54
|
version 1.46, 2003/10/22 14:26:03
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%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 |
|
|
| |
Boolean FileSystem::existsNoCase(const String& path, String& realPath) | Boolean FileSystem::existsNoCase(const String& path, String& realPath) |
{ | { |
|
#ifdef PEGASUS_OS_OS400 |
|
// The OS/400 file system is case insensitive, so just call exists( ). |
|
// This is faster, but the main reason to do this is to |
|
// avoid multi-threading problems with the IFS directory APIs |
|
// (even though they claim to be threadsafe). |
|
realPath = path; |
|
return exists(path); |
|
#else |
realPath.clear(); | realPath.clear(); |
CString cpath = _clonePath(path); | CString cpath = _clonePath(path); |
const char* p = cpath; | const char* p = cpath; |
|
|
} | } |
| |
return false; | return false; |
|
#endif |
} | } |
| |
Boolean FileSystem::canRead(const String& path) | Boolean FileSystem::canRead(const String& path) |
|
|
return false; | return false; |
| |
is.open(_clonePath(realPath) PEGASUS_IOS_BINARY); | is.open(_clonePath(realPath) PEGASUS_IOS_BINARY); |
|
|
return !!is; | return !!is; |
} | } |
| |
|
|
| |
if (!existsNoCase(path, realPath)) | if (!existsNoCase(path, realPath)) |
return false; | return false; |
|
#if defined(__GNUC__) && GCC_VERSION >= 30200 |
|
fs.open(_clonePath(realPath), PEGASUS_STD(ios_base::openmode)(mode)); |
|
#else |
|
#if defined(PEGASUS_OS_OS400) |
|
fs.open(_clonePath(realPath), mode, PEGASUS_STD(_CCSID_T(1208)) ); |
|
#else |
fs.open(_clonePath(realPath), mode); | fs.open(_clonePath(realPath), mode); |
|
#endif |
|
#endif |
return !!fs; | return !!fs; |
} | } |
| |
|
|
} | } |
} | } |
| |
|
// Return the just the base name from the path. |
|
String FileSystem::extractFileName(const String& path) |
|
{ |
|
char *p_path = new char[path.size() + 1]; |
|
String basename = System::extract_file_name((const char *)path.getCString(), p_path); |
|
|
|
delete [] p_path; |
|
|
|
return basename; |
|
} |
|
|
|
// Return just the path to the file or directory into path |
|
String FileSystem::extractFilePath(const String& path) |
|
{ |
|
char *p_path = new char[path.size() + 1]; |
|
String newpath = System::extract_file_path((const char *)path.getCString(), p_path); |
|
|
|
delete [] p_path; |
|
|
|
return newpath; |
|
} |
|
|
|
|
Boolean GetLine(PEGASUS_STD(istream)& is, String& line) | Boolean GetLine(PEGASUS_STD(istream)& is, String& line) |
{ | { |
line.clear(); | line.clear(); |