version 1.47.4.1, 2004/03/16 22:56:32
|
version 1.51, 2004/08/26 03:23:14
|
|
|
// | // |
// Modified By: | // Modified By: |
// Ramnath Ravindran(Ramnath.Ravindran@compaq.com) | // Ramnath Ravindran(Ramnath.Ravindran@compaq.com) |
|
// Amit K Arora, IBM (amita@in.ibm.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
|
//#include <cstdio> | //#include <cstdio> |
#include <Pegasus/Common/Config.h> | #include <Pegasus/Common/Config.h> |
#include <Pegasus/Common/System.h> | #include <Pegasus/Common/System.h> |
#include "Destroyer.h" |
#include <Pegasus/Common/AutoPtr.h> |
#include "FileSystem.h" | #include "FileSystem.h" |
#include "Dir.h" | #include "Dir.h" |
| |
|
|
// Return the just the base name from the path. | // Return the just the base name from the path. |
String FileSystem::extractFileName(const String& path) | String FileSystem::extractFileName(const String& path) |
{ | { |
char *p_path = new char[path.size() + 1]; |
AutoArrayPtr<char> p_path(new char[path.size() + 1]); |
String basename = System::extract_file_name((const char *)path.getCString(), p_path); |
String basename = System::extract_file_name((const char *)path.getCString(), p_path.get()); |
|
|
delete [] p_path; |
|
| |
return basename; | return basename; |
} | } |
|
|
// Return just the path to the file or directory into path | // Return just the path to the file or directory into path |
String FileSystem::extractFilePath(const String& path) | String FileSystem::extractFilePath(const String& path) |
{ | { |
char *p_path = new char[path.size() + 1]; |
AutoArrayPtr<char> p_path(new char[path.size() + 1]); |
String newpath = System::extract_file_path((const char *)path.getCString(), p_path); |
String newpath = System::extract_file_path((const char *)path.getCString(), p_path.get()); |
|
|
delete [] p_path; |
|
| |
return newpath; | return newpath; |
} | } |
|
|
// EBCDIC coversion in SystemUnix.cpp | // EBCDIC coversion in SystemUnix.cpp |
CString tempPath = path.getCString(); | CString tempPath = path.getCString(); |
#else | #else |
CString tempPath = path.getCStringUTF8(); |
CString tempPath = path.getCString(); |
#endif | #endif |
| |
return System::changeFilePermissions(tempPath, mode); | return System::changeFilePermissions(tempPath, mode); |
|
|
return root; | return root; |
} | } |
| |
|
String FileSystem::buildLibraryFileName(const String &libraryName) |
|
{ |
|
String fileName; |
|
|
|
// |
|
// Add the necessary prefix and suffix to convert the library name to its |
|
// corresponding file name. |
|
// |
|
#if defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) |
|
fileName = libraryName + String(".dll"); |
|
#elif defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) |
|
fileName = String("lib") + libraryName + String(".sl"); |
|
#elif defined(PEGASUS_OS_OS400) |
|
fileName = libraryName; |
|
#elif defined(PEGASUS_OS_DARWIN) |
|
fileName = String("lib") + libraryName + String(".dylib"); |
|
#else |
|
fileName = String("lib") + libraryName + String(".so"); |
|
#endif |
|
|
|
return fileName; |
|
} |
|
|
| |
Boolean GetLine(PEGASUS_STD(istream)& is, String& line) | Boolean GetLine(PEGASUS_STD(istream)& is, String& line) |
{ | { |