Panda3D

configVariableFilename.cxx

00001 // Filename: configVariableFilename.cxx
00002 // Created by:  drose (22Nov04)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "configVariableFilename.h"
00016 #include "executionEnvironment.h"
00017 
00018 ////////////////////////////////////////////////////////////////////
00019 //     Function: ConfigVariableFilename::reload_cache
00020 //       Access: Private
00021 //  Description: Recopies the config variable into the Filename for
00022 //               returning its value.
00023 ////////////////////////////////////////////////////////////////////
00024 void ConfigVariableFilename::
00025 reload_cache() {
00026   nassertv(_core != (ConfigVariableCore *)NULL);
00027   mark_cache_valid(_local_modified);
00028 
00029   const ConfigDeclaration *decl = _core->get_declaration(0);
00030   const ConfigPage *page = decl->get_page();
00031 
00032   Filename page_filename(page->get_name());
00033   Filename page_dirname = page_filename.get_dirname();
00034   ExecutionEnvironment::shadow_environment_variable("THIS_PRC_DIR", page_dirname.to_os_specific());
00035 
00036   _cache = Filename::expand_from(decl->get_string_value());
00037   ExecutionEnvironment::clear_shadow("THIS_PRC_DIR");
00038 }
 All Classes Functions Variables Enumerations