version 1.44, 2003/08/12 18:01:01
|
version 1.48, 2004/03/16 23:05:00
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%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 |
|
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <iostream> | #include <iostream> |
#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 "Destroyer.h" |
|
|
if (!existsNoCase(path, realPath)) | if (!existsNoCase(path, realPath)) |
return false; | return false; |
| |
#if defined(PEGASUS_OS_OS400) |
|
CString tempPath = _clonePath(realPath); |
|
const char * tmp = tempPath; |
|
AtoE((char *)tmp); |
|
is.open(tmp PEGASUS_IOS_BINARY); |
|
#else |
|
is.open(_clonePath(realPath) PEGASUS_IOS_BINARY); | is.open(_clonePath(realPath) PEGASUS_IOS_BINARY); |
#endif |
|
| |
return !!is; | return !!is; |
} | } |
|
|
fs.open(_clonePath(realPath), PEGASUS_STD(ios_base::openmode)(mode)); | fs.open(_clonePath(realPath), PEGASUS_STD(ios_base::openmode)(mode)); |
#else | #else |
#if defined(PEGASUS_OS_OS400) | #if defined(PEGASUS_OS_OS400) |
CString tempPath = _clonePath(realPath); |
fs.open(_clonePath(realPath), mode, PEGASUS_STD(_CCSID_T(1208)) ); |
const char * tmp = tempPath; |
|
AtoE((char *)tmp); |
|
fs.open(tmp, mode, PEGASUS_STD(_CCSID_T(1208)) ); |
|
#else | #else |
fs.open(_clonePath(realPath), mode); | fs.open(_clonePath(realPath), mode); |
#endif | #endif |
|
|
return newpath; | return newpath; |
} | } |
| |
|
// Changes file permissions on the given file. |
|
Boolean FileSystem::changeFilePermissions(const String& path, mode_t mode) |
|
{ |
|
#if defined(PEGASUS_OS_OS400) |
|
// ATTN: If getCString() is modified to return UTF8, then handle the |
|
// EBCDIC coversion in SystemUnix.cpp |
|
CString tempPath = path.getCString(); |
|
#else |
|
CString tempPath = path.getCStringUTF8(); |
|
#endif |
|
|
|
return System::changeFilePermissions(tempPath, mode); |
|
} |
|
|
|
String FileSystem::getAbsoluteFileName(const String &paths, const String &filename) { |
|
|
|
Uint32 pos =0; |
|
Uint32 token=0; |
|
String path = String::EMPTY; |
|
String root = String::EMPTY; |
|
String tempPath = paths; |
|
do { |
|
if (( pos = tempPath.find(FileSystem::getPathDelimiter())) == PEG_NOT_FOUND) { |
|
pos = tempPath.size(); |
|
token = 0; |
|
} |
|
else { |
|
token = 1; |
|
} |
|
path = tempPath.subString(0, pos); |
|
tempPath.remove(0,pos+token); |
|
if (FileSystem::exists( path + "/" + filename ) == true) { |
|
root = path + "/" + filename; |
|
break; |
|
} else |
|
{ |
|
// cout << "File does not exist.\n"; |
|
} |
|
} while (tempPath.size() > 0); |
|
return root; |
|
} |
|
|
| |
Boolean GetLine(PEGASUS_STD(istream)& is, String& line) | Boolean GetLine(PEGASUS_STD(istream)& is, String& line) |
{ | { |