Panda3D
filenameUnifier.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file filenameUnifier.h
10  * @author drose
11  * @date 2000-12-05
12  */
13 
14 #ifndef FILENAMEUNIFIER_H
15 #define FILENAMEUNIFIER_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "filename.h"
20 
21 #include "pmap.h"
22 
23 /**
24  * This static class does the job of converting filenames from relative to
25  * absolute to canonical or whatever is appropriate. Its main purpose is to
26  * allow us to write relative pathnames to the bam file and turn them back
27  * into absolute pathnames on read, so that a given bam file does not get tied
28  * to absolute pathnames.
29  */
31 public:
32  static void set_txa_filename(const Filename &txa_filename);
33  static void set_rel_dirname(const Filename &rel_dirname);
34 
35  static Filename make_bam_filename(Filename filename);
36  static Filename get_bam_filename(Filename filename);
37  static Filename make_egg_filename(Filename filename);
38  static Filename make_user_filename(Filename filename);
39  static void make_canonical(Filename &filename);
40 
41 private:
42 
43  static Filename _txa_filename;
44  static Filename _txa_dir;
45  static Filename _rel_dirname;
46 
48  static CanonicalFilenames _canonical_filenames;
49 };
50 
51 #endif
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 get_bam_filename(Filename filename)
Returns an absolute pathname based on the given relative pathname, presumably read from the bam file ...
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...
static void set_rel_dirname(const Filename &rel_dirname)
Sets the name of the directory that texture filenames will be written relative to,...
static void make_canonical(Filename &filename)
Does the same thing as Filename::make_canonical()–it converts the filename to its canonical form–but ...
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:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.