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

Diff for /pegasus/src/Pegasus/Common/FileSystem.cpp between version 1.38 and 1.43.6.1

version 1.38, 2002/08/29 00:27:52 version 1.43.6.1, 2003/08/13 19:39:50
Line 34 
Line 34 
 #include <Pegasus/Common/System.h> #include <Pegasus/Common/System.h>
 #include "Destroyer.h" #include "Destroyer.h"
 #include "FileSystem.h" #include "FileSystem.h"
 #include "System.h"  
 #include "Dir.h" #include "Dir.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 70 
Line 69 
  
 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;
  
     const char* dirPath;     const char* dirPath;
     const char* fileName;     const char* fileName;
     char* slash = strrchr(p, '/');      char* slash = (char *) strrchr(p, '/');
  
     if (slash)     if (slash)
     {     {
Line 96 
Line 103 
  
     for (Dir dir(dirPath); dir.more(); dir.next())     for (Dir dir(dirPath); dir.more(); dir.next())
     {     {
         if (CompareNoCase(fileName, dir.getName()) == 0)          if (System::strcasecmp(fileName, dir.getName()) == 0)
         {         {
             if (strcmp(dirPath, ".") == 0)             if (strcmp(dirPath, ".") == 0)
                 realPath = dir.getName();                 realPath = dir.getName();
Line 111 
Line 118 
     }     }
  
     return false;     return false;
   #endif
 } }
  
 Boolean FileSystem::canRead(const String& path) Boolean FileSystem::canRead(const String& path)
Line 226 
Line 234 
     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;
 } }
  
Line 239 
Line 255 
  
     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)
       CString tempPath = _clonePath(realPath);
       const char * tmp = tempPath;
       AtoE((char *)tmp);
       fs.open(tmp, mode, PEGASUS_STD(_CCSID_T(1208)) );
   #else
     fs.open(_clonePath(realPath), mode);     fs.open(_clonePath(realPath), mode);
   #endif
   #endif
     return !!fs;     return !!fs;
 } }
  
Line 358 
Line 384 
     }     }
 } }
  
   // 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();


Legend:
Removed from v.1.38  
changed lines
  Added in v.1.43.6.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2