00001 // Filename: virtualFileComposite.cxx 00002 // Created by: drose (03Aug02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "virtualFileComposite.h" 00020 00021 TypeHandle VirtualFileComposite::_type_handle; 00022 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Function: VirtualFileComposite::get_file_system 00026 // Access: Published, Virtual 00027 // Description: Returns the VirtualFileSystem this file is associated 00028 // with. 00029 //////////////////////////////////////////////////////////////////// 00030 VirtualFileSystem *VirtualFileComposite:: 00031 get_file_system() const { 00032 return _file_system; 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: VirtualFileComposite::get_filename 00037 // Access: Published, Virtual 00038 // Description: Returns the full pathname to this file within the 00039 // virtual file system. 00040 //////////////////////////////////////////////////////////////////// 00041 Filename VirtualFileComposite:: 00042 get_filename() const { 00043 return _filename; 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: VirtualFileComposite::is_directory 00048 // Access: Published, Virtual 00049 // Description: Returns true if this file represents a directory (and 00050 // scan_directory() may be called), false otherwise. 00051 //////////////////////////////////////////////////////////////////// 00052 bool VirtualFileComposite:: 00053 is_directory() const { 00054 return true; 00055 } 00056 00057 //////////////////////////////////////////////////////////////////// 00058 // Function: VirtualFileComposite::scan_local_directory 00059 // Access: Protected, Virtual 00060 // Description: Fills file_list up with the list of files that are 00061 // within this directory, excluding those whose 00062 // basenames are listed in mount_points. Returns true 00063 // if successful, false if the file is not a directory 00064 // or the directory cannot be read. 00065 //////////////////////////////////////////////////////////////////// 00066 bool VirtualFileComposite:: 00067 scan_local_directory(VirtualFileList *file_list, 00068 const ov_set<string> &mount_points) const { 00069 bool any_ok = false; 00070 Components::const_iterator ci; 00071 for (ci = _components.begin(); ci != _components.end(); ++ci) { 00072 if ((*ci)->scan_local_directory(file_list, mount_points)) { 00073 any_ok = true; 00074 } 00075 } 00076 00077 return any_ok; 00078 }