Changeset 3269

Show
Ignore:
Timestamp:
03/31/07 14:58:51 (6 years ago)
Author:
balister
Message:

Pass some more test.

Location:
ossie/branches/philip-work/framework
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ossie/branches/philip-work/framework/FileManager_impl.cpp

    r3260 r3269  
    2424#include <string> 
    2525 
     26#include <boost/filesystem/path.hpp> 
     27 
    2628#include "ossie/cf.h" 
    2729#include "ossie/FileManager_impl.h" 
     
    3032FileManager_impl::FileManager_impl ():FileSystem_impl () 
    3133{ 
    32     DEBUG(4, FileManager, "Entering constructor.") 
     34    DEBUG(4, FileManager, "Entering constructor."); 
     35 
     36    if (boost::filesystem::path::default_name_check_writable()) 
     37        boost::filesystem::path::default_name_check(boost::filesystem::portable_posix_name); 
     38 
    3339    numMounts = 0; 
    3440    mount_table = new CF::FileManager::MountSequence(5); 
  • ossie/branches/philip-work/framework/FileSystem_impl.cpp

    r3264 r3269  
    3535{ 
    3636    DEBUG(6, FileSystem, "In constructor."); 
     37 
     38    if (boost::filesystem::path::default_name_check_writable()) 
     39        boost::filesystem::path::default_name_check(boost::filesystem::portable_posix_name); 
    3740 
    3841    root = boost::filesystem::initial_path(); 
     
    219222    boost::filesystem::path dirPath(root / directoryName); 
    220223 
    221     ///\todo Create entire path when needed. 
    222     try { 
    223         boost::filesystem::create_directory(dirPath); 
    224     } catch (...) { 
    225         throw CF::FileException (CF::CFENFILE, "[FileSystem::mkdir] Failed to create directory"); 
    226     } 
    227  
    228 } 
    229  
     224    boost::filesystem::path::iterator walkPath(dirPath.begin()); 
     225    boost::filesystem::path currentPath; 
     226    while (walkPath != dirPath.end()) { 
     227        DEBUG(9, FileSystem, "Walking path to create directories, current path " << currentPath.string()); 
     228        currentPath /= *walkPath; 
     229        if (!boost::filesystem::exists(currentPath)) { 
     230            DEBUG(9, FileSystem, "Creating directory " << currentPath.string()); 
     231            try { 
     232                boost::filesystem::create_directory(currentPath); 
     233            } catch (...) { 
     234                throw CF::FileException (CF::CFENFILE, "[FileSystem::mkdir] Failed to create directory"); 
     235            } 
     236        } 
     237        ++walkPath; 
     238    } 
     239} 
    230240 
    231241void FileSystem_impl::rmdir (const char *directoryName) throw (CORBA::SystemException, CF::FileException, CF::InvalidFileName) 
     
    240250    boost::filesystem::path dirPath(root / directoryName); 
    241251 
    242     boost::filesystem::remove(dirPath); 
    243  
    244 #if 0///\todo Generate proper exceptions 
    245     if (check != 0) 
    246         throw CF::FileException (CF::CFENFILE, 
    247             "[FileSystem_impl::rmdir] Failed to remove directory\n"); 
    248 #endif 
     252    ///\todo Fix case where directory contains only other empty directories 
     253    try { 
     254        boost::filesystem::remove(dirPath); 
     255    } catch (...) { 
     256    } 
    249257} 
    250258