(file) Return to FileSystem.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/FileSystem.h between version 1.19 and 1.31

version 1.19, 2002/06/01 00:56:31 version 1.31, 2003/12/08 21:29:01
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%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
Line 32 
Line 34 
  
 #include <Pegasus/Common/Config.h> #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/String.h> #include <Pegasus/Common/String.h>
 #include <Pegasus/Common/Array.h>  #include <Pegasus/Common/ArrayInternal.h>
 #include <Pegasus/Common/Exception.h>  #include <Pegasus/Common/InternalException.h>
   #include <Pegasus/Common/System.h>
   #include <Pegasus/Common/Linkage.h>
 #include <fstream> #include <fstream>
   #include <cstdio>
   #if defined(PEGASUS_OS_OS400)
   #include "OS400ConvertChar.h"
   #endif
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
Line 280 
Line 288 
     */     */
     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);
   
       /** Return the just the filename to the file name into base.
       */
       static String extractFileName(const String& base);
   
       /** Return the just the path to the file name into path.
       */
       static String extractFilePath(const String& path);
   
       /** Changes file permissions on the given file.
           @param path path of the file.
           @param mode the bit-wise inclusive OR of the values for the
           desired permissions.
           @return true on success, false on error and errno is set appropriately.
       */
       static Boolean changeFilePermissions(const String& path, mode_t mode);
   
 private: private:
  
     FileSystem() { }     FileSystem() { }
Line 343 
Line 374 
     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 (!System::is_absolute_path(filename.getCString()) && 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();  #if defined(PEGASUS_OS_OS400)
     is.open(tmpPath);      is.open(path.getCString(), PEGASUS_STD(_CCSID_T(1208)));
     delete [] tmpPath;  #else
       is.open(path.getCString());
   #endif
     return !!is;     return !!is;
 } }
  
 inline Boolean Open(PEGASUS_STD(ofstream)& os, const String& path) inline Boolean Open(PEGASUS_STD(ofstream)& os, const String& path)
 { {
     char* tmpPath = path.allocateCString();  #if defined(PEGASUS_OS_OS400)
     os.open(tmpPath);      os.open(path.getCString(), PEGASUS_STD(_CCSID_T(1208)));
     delete [] tmpPath;  #else
       os.open(path.getCString());
   #endif
     return !!os;     return !!os;
 } }
  
 inline Boolean OpenAppend(PEGASUS_STD(ofstream)& os, const String& path) inline Boolean OpenAppend(PEGASUS_STD(ofstream)& os, const String& path)
 { {
     char* tmpPath = path.allocateCString();  #if defined(PEGASUS_OS_OS400)
     os.open(tmpPath, PEGASUS_STD(ios::app));      os.open(path.getCString(), PEGASUS_STD(ios::app), PEGASUS_STD(_CCSID_T(1208)));
     delete [] tmpPath;  #else
       os.open(path.getCString(), PEGASUS_STD(ios::app));
   #endif
     return !!os;     return !!os;
 } }
  


Legend:
Removed from v.1.19  
changed lines
  Added in v.1.31

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2