Changeset 11064
- Timestamp:
- 03/12/12 16:09:32 (15 months ago)
- Location:
- ossiedev/branches/jsnyder/trunk
- Files:
-
- 7 modified
-
Makefile.am (modified) (1 diff)
-
system/ossie/framework/FileManager_impl.cpp (modified) (5 diffs)
-
system/ossie/framework/FileSystem_impl.cpp (modified) (6 diffs)
-
system/ossie/framework/File_impl.cpp (modified) (2 diffs)
-
system/ossie/framework/helperFunctions.cpp (modified) (3 diffs)
-
system/ossie/include/ossie/FileSystem_impl.h (modified) (3 diffs)
-
system/ossie/parser/DASParser.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/branches/jsnyder/trunk/Makefile.am
r11060 r11064 61 61 62 62 install-data-hook: 63 -cp -rf $(prefix)/lib/* $(libdir) 64 -rm -rf $(prefix)/lib 63 -if [ $(prefix)/lib != $(libdir) ]; then \ 64 cp -rf $(prefix)/lib/* $(libdir); \ 65 rm -rf $(prefix)/lib; \ 66 fi 65 67 -cp -rf $(prefix)/dom/xml/dtd/ $(prefix)/dev/xml/ 66 -mv $(prefix)/bin/nodeBooter $(nbdir) 67 -mv $(prefix)/bin/c_wavLoader $(nbdir) 68 -if [ $(prefix)/bin != $(nbdir) ]; then \ 69 mv $(prefix)/bin/nodeBooter $(nbdir); \ 70 mv $(prefix)/bin/c_wavLoader $(nbdir); \ 71 fi 68 72 -chown -R $(SUDO_USER).$(SUDO_USER) $(prefix) 69 73 -
ossiedev/branches/jsnyder/trunk/system/ossie/framework/FileManager_impl.cpp
r11048 r11064 23 23 #include <iostream> 24 24 #include <string> 25 #include <sstream> 26 27 #include <boost/filesystem/operations.hpp> 28 #include <boost/filesystem/path.hpp> 29 #include <boost/filesystem/exception.hpp> 30 31 #ifndef BOOST_VERSION 32 #include <boost/version.hpp> 33 #endif 34 35 #if BOOST_VERSION < 103500 36 # include <boost/filesystem/cerrno.hpp> 37 #else 38 # include <boost/cerrno.hpp> 39 #endif 40 41 namespace fs = boost::filesystem; 25 42 26 43 27 #include "ossie/cf.h" 44 28 #include "ossie/FileManager_impl.h" 45 29 #include "ossie/debug.h" 30 #include "ossie/ossieSupport.h" 46 31 47 32 FileManager_impl::FileManager_impl ():FileSystem_impl () … … 251 236 int result_length = 0; 252 237 int tmp_length = 0; 253 try {254 238 for ( unsigned int i = 0; i < numMounts; i++ ) { 255 239 DEBUG(4, FileManager, "Calling FileSystem->list"); … … 282 266 DEBUG(4, FileManager, "About to return from list"); 283 267 return result._retn(); 284 } catch (const fs::filesystem_error &ex) {285 #if BOOST_VERSION < 103400286 DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.error());287 if (ex.error() == fs::other_error)288 #elif BOOST_VERSION < 103500289 DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.system_error());290 if (ex.system_error() == EINVAL)291 #else292 DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.code().value()); ;293 if (ex.code().value() == EINVAL)294 #endif295 throw CF::InvalidFileName(CF::CFEINVAL, ex.what());296 throw CF::FileException(CF::CFNOTSET, ex.what());297 }298 268 } 299 269 … … 491 461 DEBUG(5, FileManager, "Entering getFSandFSPath with path " << path); 492 462 493 fs::path fullPath(path);494 fs::path::iterator fullItr(fullPath.begin());495 463 std::string tmpFSPath; 496 464 … … 514 482 DEBUG(5, FileManager, "Entering pathMatches with path " << path << " mount point " << mPoint); 515 483 516 fs::path fullPath(path); 517 fs::path::iterator fullItr(fullPath.begin()); 518 519 fs::path mPath(mPoint); 520 fs::path::iterator mItr(mPath.begin()); 521 522 unsigned int commonElements(0); 523 524 while (fullItr != fullPath.end()) { 525 if (*fullItr != *mItr) 526 break; 527 ++fullItr; 528 ++mItr; 529 ++commonElements; 530 } 531 532 533 fs::path localPath("/"); 534 535 while (fullItr != fullPath.end()) { 536 localPath /= *fullItr; 537 ++fullItr; 538 } 539 FSPath = localPath.string(); 484 unsigned n = 0, commonElements = 0; 485 for (n = 0; *path && *mPoint && *path == *mPoint; n++, path++, mPoint++) 486 if (n && *path == '/') 487 commonElements++; 488 FSPath = path; 540 489 541 490 DEBUG(5, FileManager, "Path matches with " << commonElements << " path elements in common and remaining path " << FSPath); -
ossiedev/branches/jsnyder/trunk/system/ossie/framework/FileSystem_impl.cpp
r11048 r11064 21 21 ****************************************************************************/ 22 22 23 #include <string> 24 #include "ossie/FileSystem_impl.h" 25 26 #ifdef USE_OPENCPI_FS 27 #include "OcpiUtilFileFs.h" 28 #include "OcpiCFUtilVfsFileSystem.h" 29 30 31 FileSystem_impl::FileSystem_impl() 32 : OCPI::CFUtil::VfsFileSystem(ossieSupport::ORB::poa, 33 new OCPI::Util::FileFs::FileFs()) 34 { 35 } 36 FileSystem_impl::FileSystem_impl(const char *root) 37 : OCPI::CFUtil::VfsFileSystem(ossieSupport::ORB::poa, 38 new OCPI::Util::FileFs::FileFs(root)) 39 { 40 } 41 42 FileSystem_impl::~FileSystem_impl(){} 43 44 // static 45 bool FileSystem_impl::isValidPath(const char *path) { 46 try { 47 std::string s(path); 48 testFileName(s); 49 } catch (...) { 50 return false; 51 } 52 return true; 53 } 54 55 // static 56 void FileSystem_impl::joinPath(const char *base, const char *rel, std::string &result) { 57 result = OCPI::Util::Vfs::joinNames(OCPI::Util::Vfs::directoryName(base), rel); 58 } 59 60 #else 23 61 /* SCA */ 24 62 25 63 #include <iostream> 26 #include <string>27 28 64 #include <fnmatch.h> 29 65 … … 43 79 namespace fs = boost::filesystem; 44 80 45 #include "ossie/FileSystem_impl.h"46 81 #include "ossie/debug.h" 47 82 … … 76 111 DEBUG(6, FileSystem, "In destructor."); 77 112 } 113 114 // Filename utility functions as static member functions of FileSystem_impl, 115 // implemented using boost here, to limit boost dependency to here 116 // static 117 bool FileSystem_impl::isValidPath(const char *fileName) { 118 try { 119 fs::path testPath(fileName); 120 } catch (...) { 121 return false; 122 } 123 124 return true; 125 } 126 // static 127 void FileSystem_impl::joinPath(const char *spdFile, const char *name, std::string &fileName) { 128 fs::path spdPath(spdFile); 129 130 fs::path filePath = spdPath.branch_path() / name; 131 132 fileName = filePath.string(); 133 } 134 78 135 79 136 void FileSystem_impl::remove (const char *fileName) throw (CORBA::SystemException, CF::FileException, CF::InvalidFileName) … … 157 214 DEBUG(9, FileSystem, "In list checking file " << itr->path().filename()); 158 215 if (fnmatch(searchPattern.c_str(), itr->path().filename().c_str(), 0) == 0) { 159 DEBUG(9, FileSystem, "Match in list with " << itr->path(). filename());216 DEBUG(9, FileSystem, "Match in list with " << itr->path().string()); 160 217 fis->length(idx + 1); 161 218 … … 214 271 result->length(0); 215 272 216 recursiveList(rootDirPath, pattern, result); 217 273 try { 274 recursiveList(rootDirPath, pattern, result); 275 } catch (const fs::filesystem_error &ex) { 276 // Convert boost fs errors into SCA FileSystem errors 277 #if BOOST_VERSION < 103400 278 DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.error()); 279 if (ex.error() == fs::other_error) 280 #elif BOOST_VERSION < 103500 281 DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.system_error()); 282 if (ex.system_error() == EINVAL) 283 #else 284 DEBUG(9, FileManager, "Caught exception in list, error_code " << ex.code().value()); ; 285 if (ex.code().value() == EINVAL) 286 #endif 287 throw CF::InvalidFileName(CF::CFEINVAL, ex.what()); 288 throw CF::FileException(CF::CFNOTSET, ex.what()); 289 } 218 290 return result._retn(); 219 291 } … … 369 441 370 442 ///\todo Implement File object reference clean up. 443 #endif /* end of else of ifdef USE_OPENCPI_FS */ -
ossiedev/branches/jsnyder/trunk/system/ossie/framework/File_impl.cpp
r9807 r11064 21 21 ****************************************************************************/ 22 22 23 #ifndef USE_OPENCPI_FS // This entire file isn't needed of we are using OpenCPI FS 23 24 #include <iostream> 24 25 #include <fstream> … … 136 137 f.seekp(_filePointer); 137 138 } 139 #endif /* of ifndef USE_OPENCPI_FS */ -
ossiedev/branches/jsnyder/trunk/system/ossie/framework/helperFunctions.cpp
r11048 r11064 24 24 #include <iostream> 25 25 26 #include <boost/filesystem/path.hpp> 27 28 namespace fs = boost::filesystem; 26 #include "ossie/FileSystem_impl.h" 29 27 30 28 #include <ossie/ossieSupport.h> … … 40 38 bool ossieSupport::isValidFileName(const char *fileName) 41 39 { 42 try { 43 fs::path testPath(fileName); 44 } catch (...) { 45 return false; 46 } 47 48 return true; 40 return FileSystem_impl::isValidPath(fileName); 49 41 } 50 42 … … 52 44 { 53 45 DEBUG(9, spd_rel_file, "Called with spdFile: " << spdFile << ", name: " << name); 54 fs::path spdPath(spdFile);55 46 56 fs::path filePath = spdPath.branch_path() / name; 57 58 fileName = filePath.string(); 47 FileSystem_impl::joinPath(spdFile, name, fileName); 59 48 60 49 DEBUG(9, spd_rel_file, "Result: " << fileName); -
ossiedev/branches/jsnyder/trunk/system/ossie/include/ossie/FileSystem_impl.h
r9807 r11064 25 25 #define __FILESYSTEM_IMPL__ 26 26 27 #include "ossie/cf.h" 28 #include "ossie/ossieSupport.h" 29 #ifdef USE_OPENCPI_FS 30 31 #include "OcpiCFUtilVfsFileSystem.h" 32 33 class FileSystem_impl : OCPI::CFUtil::VfsFileSystem, virtual public POA_CF::FileSystem { 34 public: 35 // The standalone constructor to create a file system based on a URL 36 FileSystem_impl(const char *url); 37 FileSystem_impl(); 38 ~FileSystem_impl(); 39 static bool isValidPath(const char *path); 40 static void joinPath(const char *base, const char *rel, std::string &result); 41 }; 42 #else 43 27 44 #include <vector> 28 45 #include <string> … … 41 58 FileSystem_impl (const char *_root); 42 59 ~ FileSystem_impl (); 60 61 static bool isValidPath(const char *path); 62 63 static void joinPath(const char *base, const char *rel, std::string &result); 43 64 44 65 void remove (const char *fileName) … … 89 110 90 111 }; /* END CLASS DEFINITION FileSystem */ 112 #endif /* end of else of ifdef USE_OPENCPI_FS */ 91 113 #endif /* __FILESYSTEM__ */ -
ossiedev/branches/jsnyder/trunk/system/ossie/parser/DASParser.cpp
r9807 r11064 38 38 das_file->read(fileData, fileSize); 39 39 40 das_file->close();40 // das_file->close(); removed this since the only caller does this, like others 41 41 42 42 unsigned char *fileBuffer = fileData->get_buffer();