Panda3D
|
This represents the root of the tree of source directory files. More...
#include "cvsSourceTree.h"
Classes | |
class | FilePath |
Public Member Functions | |
void | add_file (const string &basename, CVSSourceDirectory *dir) |
Adds a new file to the set of known files. More... | |
FilePath | choose_directory (const string &basename, CVSSourceDirectory *suggested_dir, bool force, bool interactive) |
Determines where an externally referenced model file of the indicated name should go. More... | |
CVSSourceDirectory * | find_directory (const Filename &path) |
Returns the source directory that corresponds to the given path, or NULL if there is no such directory in the source tree. More... | |
CVSSourceDirectory * | find_dirname (const string &dirname) |
Returns the source directory that corresponds to the given local directory name, or NULL if there is no match. More... | |
CVSSourceDirectory * | find_relpath (const string &relpath) |
Returns the source directory that corresponds to the given relative path from the root, or NULL if there is no match. More... | |
CVSSourceDirectory * | get_root () const |
Returns the root directory of the hierarchy. More... | |
Filename | get_root_dirname () const |
Returns the local directory name of the root of the tree. More... | |
Filename | get_root_fullpath () |
Returns the full path from the root to the top of the source hierarchy. More... | |
bool | scan (const Filename &key_filename) |
Scans the complete source directory starting at the indicated pathname. More... | |
void | set_root (const Filename &root_path) |
Sets the root of the source directory. More... | |
Static Public Member Functions | |
static void | restore_cwd () |
Restores the current directory after changing it from temp_chdir(). More... | |
static bool | temp_chdir (const Filename &path) |
Temporarily changes the current directory to the named path. More... | |
This represents the root of the tree of source directory files.
The tree is maintained in a case-insensitive manner, even on a non-Windows system, since you might want to eventually check out the CVS tree onto a Windows system–and if you do, you'll be sad if there are case conflicts within the tree. So we make an effort to ensure this doesn't happen by treating two files with a different case as the same file.
Definition at line 39 of file cvsSourceTree.h.
void CVSSourceTree::add_file | ( | const string & | basename, |
CVSSourceDirectory * | dir | ||
) |
Adds a new file to the set of known files.
This is normally called from CVSSourceDirectory::scan() and should not be called directly by the user.
Definition at line 232 of file cvsSourceTree.cxx.
References temp_chdir().
Referenced by get_root_dirname(), and CVSSourceDirectory::scan().
CVSSourceTree::FilePath CVSSourceTree::choose_directory | ( | const string & | basename, |
CVSSourceDirectory * | suggested_dir, | ||
bool | force, | ||
bool | interactive | ||
) |
Determines where an externally referenced model file of the indicated name should go.
It does this by looking for an existing model file of the same name; if a matching model is not found, or if multiple matching files are found, prompts the user for the directory, or uses suggested_dir.
Definition at line 177 of file cvsSourceTree.cxx.
References get_root_fullpath().
Referenced by find_dirname(), and CVSCopy::import().
CVSSourceDirectory * CVSSourceTree::find_directory | ( | const Filename & | path | ) |
Returns the source directory that corresponds to the given path, or NULL if there is no such directory in the source tree.
Definition at line 105 of file cvsSourceTree.cxx.
References find_relpath(), CVSSourceDirectory::find_relpath(), and get_root_fullpath().
Referenced by CVSCopy::continue_after_error(), get_root(), and restore_cwd().
CVSSourceDirectory * CVSSourceTree::find_dirname | ( | const string & | dirname | ) |
Returns the source directory that corresponds to the given local directory name, or NULL if there is no match.
Definition at line 162 of file cvsSourceTree.cxx.
References choose_directory(), and CVSSourceDirectory::find_dirname().
Referenced by find_relpath(), and restore_cwd().
CVSSourceDirectory * CVSSourceTree::find_relpath | ( | const string & | relpath | ) |
Returns the source directory that corresponds to the given relative path from the root, or NULL if there is no match.
The relative path may or may not include the name of the root directory itself.
Definition at line 132 of file cvsSourceTree.cxx.
References find_dirname(), CVSSourceDirectory::find_relpath(), and CVSSourceDirectory::get_dirname().
Referenced by CVSCopy::continue_after_error(), find_directory(), and restore_cwd().
CVSSourceDirectory * CVSSourceTree::get_root | ( | ) | const |
Returns the root directory of the hierarchy.
Definition at line 93 of file cvsSourceTree.cxx.
References find_directory().
Referenced by scan().
Filename CVSSourceTree::get_root_dirname | ( | ) | const |
Returns the local directory name of the root of the tree.
Definition at line 219 of file cvsSourceTree.cxx.
References add_file(), and CVSSourceDirectory::get_dirname().
Referenced by CVSCopy::continue_after_error(), and get_root_fullpath().
Filename CVSSourceTree::get_root_fullpath | ( | ) |
Returns the full path from the root to the top of the source hierarchy.
Definition at line 203 of file cvsSourceTree.cxx.
References get_root_dirname().
Referenced by choose_directory(), CVSCopy::continue_after_error(), find_directory(), CVSSourceDirectory::get_fullpath(), and scan().
|
static |
Restores the current directory after changing it from temp_chdir().
Definition at line 265 of file cvsSourceTree.cxx.
References CVSSourceTree::FilePath::FilePath(), find_directory(), find_dirname(), find_relpath(), ExecutionEnvironment::get_cwd(), CVSSourceDirectory::get_path(), CVSSourceTree::FilePath::get_path(), CVSSourceTree::FilePath::is_valid(), Filename::make_canonical(), and Filename::to_os_specific().
Referenced by CVSCopy::continue_after_error(), and temp_chdir().
bool CVSSourceTree::scan | ( | const Filename & | key_filename | ) |
Scans the complete source directory starting at the indicated pathname.
It is an error to call this more than once. Returns true on success, false if there is an error.
Definition at line 80 of file cvsSourceTree.cxx.
References Filename::get_basename(), get_root(), get_root_fullpath(), and CVSSourceDirectory::scan().
Referenced by CVSCopy::continue_after_error(), and set_root().
void CVSSourceTree::set_root | ( | const Filename & | root_path | ) |
Sets the root of the source directory.
This must be called before scan(), and should not be called more than once.
Definition at line 66 of file cvsSourceTree.cxx.
References scan().
Referenced by CVSCopy::continue_after_error().
|
static |
Temporarily changes the current directory to the named path.
Returns true on success, false on failure. Call restore_cwd() to restore to the original directory later.
Definition at line 246 of file cvsSourceTree.cxx.
References restore_cwd(), and Filename::to_os_specific().
Referenced by add_file(), and CVSCopy::continue_after_error().