Panda3D
 All Classes Functions Variables Enumerations
filenameUnifier.h
1 // Filename: filenameUnifier.h
2 // Created by: drose (05Dec00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef FILENAMEUNIFIER_H
16 #define FILENAMEUNIFIER_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "filename.h"
21 
22 #include "pmap.h"
23 
24 ////////////////////////////////////////////////////////////////////
25 // Class : FilenameUnifier
26 // Description : This static class does the job of converting
27 // filenames from relative to absolute to canonical or
28 // whatever is appropriate. Its main purpose is to
29 // allow us to write relative pathnames to the bam file
30 // and turn them back into absolute pathnames on read,
31 // so that a given bam file does not get tied to
32 // absolute pathnames.
33 ////////////////////////////////////////////////////////////////////
35 public:
36  static void set_txa_filename(const Filename &txa_filename);
37  static void set_rel_dirname(const Filename &rel_dirname);
38 
39  static Filename make_bam_filename(Filename filename);
40  static Filename get_bam_filename(Filename filename);
41  static Filename make_egg_filename(Filename filename);
42  static Filename make_user_filename(Filename filename);
43  static void make_canonical(Filename &filename);
44 
45 private:
46 
47  static Filename _txa_filename;
48  static Filename _txa_dir;
49  static Filename _rel_dirname;
50 
52  static CanonicalFilenames _canonical_filenames;
53 };
54 
55 #endif
56 
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 f...
This static class does the job of converting filenames from relative to absolute to canonical or what...
static void set_txa_filename(const Filename &txa_filename)
Notes the filename the .txa file was found in.
static Filename make_user_filename(Filename filename)
Returns a new filename that's made relative to the current directory, suitable for reporting to the u...
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...
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
static Filename get_bam_filename(Filename filename)
Returns an absolute pathname based on the given relative pathname, presumably read from the bam file ...
static void make_canonical(Filename &filename)
Does the same thing as Filename::make_canonical()–it converts the filename to its canonical form–but ...
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.