Panda3D
Static Public Member Functions | List of all members
FilenameUnifier Class Reference

This static class does the job of converting filenames from relative to absolute to canonical or whatever is appropriate. More...

#include "filenameUnifier.h"

Static Public Member Functions

static Filename get_bam_filename (Filename filename)
 Returns an absolute pathname based on the given relative pathname, presumably read from the bam file and relative to the bam file. More...
 
static Filename make_bam_filename (Filename filename)
 Returns a new filename that's made relative to the bam file itself, suitable for writing to the bam file. More...
 
static void make_canonical (Filename &filename)
 Does the same thing as Filename::make_canonical()–it converts the filename to its canonical form–but caches the operation so that repeated calls to filenames in the same directory will tend to be faster. More...
 
static Filename make_egg_filename (Filename filename)
 Returns a new filename that's made relative to the rel_directory, suitable for writing out within egg files. More...
 
static Filename make_user_filename (Filename filename)
 Returns a new filename that's made relative to the current directory, suitable for reporting to the user. More...
 
static void set_rel_dirname (const Filename &rel_dirname)
 Sets the name of the directory that texture filenames will be written relative to, when generating egg files. More...
 
static void set_txa_filename (const Filename &txa_filename)
 Notes the filename the .txa file was found in. More...
 

Detailed Description

This static class does the job of converting filenames from relative to absolute to canonical or whatever is appropriate.

Its main purpose is to allow us to write relative pathnames to the bam file and turn them back into absolute pathnames on read, so that a given bam file does not get tied to absolute pathnames.

Definition at line 30 of file filenameUnifier.h.

Member Function Documentation

◆ get_bam_filename()

Filename FilenameUnifier::get_bam_filename ( Filename  filename)
static

Returns an absolute pathname based on the given relative pathname, presumably read from the bam file and relative to the bam file.

Definition at line 72 of file filenameUnifier.cxx.

References Filename::make_absolute().

◆ make_bam_filename()

Filename FilenameUnifier::make_bam_filename ( Filename  filename)
static

Returns a new filename that's made relative to the bam file itself, suitable for writing to the bam file.

Definition at line 61 of file filenameUnifier.cxx.

References make_canonical(), and Filename::make_relative_to().

Referenced by ImageFile::write_datagram(), EggFile::write_datagram(), and Palettizer::write_datagram().

◆ make_canonical()

void FilenameUnifier::make_canonical ( Filename filename)
static

Does the same thing as Filename::make_canonical()–it converts the filename to its canonical form–but caches the operation so that repeated calls to filenames in the same directory will tend to be faster.

Definition at line 111 of file filenameUnifier.cxx.

References Filename::get_dirname(), Filename::make_canonical(), and Filename::set_dirname().

Referenced by make_bam_filename(), make_egg_filename(), make_user_filename(), set_rel_dirname(), and set_txa_filename().

◆ make_egg_filename()

Filename FilenameUnifier::make_egg_filename ( Filename  filename)
static

Returns a new filename that's made relative to the rel_directory, suitable for writing out within egg files.

Definition at line 84 of file filenameUnifier.cxx.

References make_canonical(), and Filename::make_relative_to().

◆ make_user_filename()

Filename FilenameUnifier::make_user_filename ( Filename  filename)
static

Returns a new filename that's made relative to the current directory, suitable for reporting to the user.

Definition at line 97 of file filenameUnifier.cxx.

References make_canonical(), and Filename::make_relative_to().

Referenced by ImageFile::output_filename(), and Palettizer::report_pi().

◆ set_rel_dirname()

void FilenameUnifier::set_rel_dirname ( const Filename rel_dirname)
static

Sets the name of the directory that texture filenames will be written relative to, when generating egg files.

This is not the directory the textures are actually written to (see set_map_dirname()), but rather is the name of some directory above that, which will be the starting point for the pathnames written to the egg files. If this is empty, the full pathnames will be written to the egg files.

Definition at line 49 of file filenameUnifier.cxx.

References make_canonical().

◆ set_txa_filename()

void FilenameUnifier::set_txa_filename ( const Filename txa_filename)
static

Notes the filename the .txa file was found in.

This may have come from the command line, or it may have been implicitly located. This has other implications for the FilenameUnifier, particularly in locating the bam file that saves the filenameUnifier state from last session.

Definition at line 31 of file filenameUnifier.cxx.

References Filename::get_dirname(), and make_canonical().


The documentation for this class was generated from the following files: