tPathResource Class Reference

#include <tDirectories.h>

Inheritance diagram for tPathResource:

Inheritance graph
[legend]
Collaboration diagram for tPathResource:

Collaboration graph
[legend]

List of all members.

Public Member Functions

tString GetWritePath (const char *filename) const

Static Public Member Functions

static tString GetDirPath ()
 returns the path to the included resources

Private Member Functions

void Paths (tArray< tString > &paths) const


Detailed Description

Definition at line 62 of file tDirectories.h.


Member Function Documentation

tString tPathResource::GetWritePath ( const char *  filename  )  const

Reimplemented from tPath.

Definition at line 655 of file tDirectories.cpp.

References free, tPath::IsValidPath(), mkdir_recurse(), Paths(), strdup, and tERR_WARN.

Referenced by tResourceManager::locateResource().

00655                                                               {
00656     if ( !tPath::IsValidPath( filename ) )
00657         return tString();
00658 
00659     tArray< tString > paths;
00660     Paths( paths );
00661 
00662     tString fullname;
00663     fullname << paths(0) << "/" << filename;
00664 
00665     {
00666         bool s;
00667 
00668         char *fpmr = strdup( static_cast< char const * >( fullname ) );
00669         s = mkdir_recurse(fpmr, paths(0).Len());
00670         free(fpmr);
00671 
00672         if (!s)
00673         {
00674             tERR_WARN( tOutput( "$directory_path_nonwritable",  fullname  ) );
00675             return tString();
00676         }
00677     }
00678 
00679     return fullname;
00680 }

Here is the call graph for this function:

Here is the caller graph for this function:

tString tPathResource::GetDirPath (  )  [static]

returns the path to the included resources

Definition at line 682 of file tDirectories.cpp.

References tString::Len(), st_DataDir, and st_IncludedResourceDir.

Referenced by _wrap_TPathResource_get_dir_path().

00683 {
00684     if ( st_IncludedResourceDir.Len() > 2 )
00685         return st_IncludedResourceDir;
00686     else
00687         return st_DataDir + "/resource/included";
00688 }

Here is the call graph for this function:

Here is the caller graph for this function:

void tPathResource::Paths ( tArray< tString > &  paths  )  const [private, virtual]

Implements tPath.

Definition at line 690 of file tDirectories.cpp.

References tString::Len(), pos, tArray< T, MALLOC >::SetLen(), st_AutoResourceDir, st_DataDir, st_IncludedResourceDir, st_ResourceDir, and st_UserDataDir.

Referenced by GetWritePath().

00690                                                         {
00691     paths.SetLen( 0 );
00692     int pos = 0;
00693 
00694     if ( st_AutoResourceDir.Len() > 1 )
00695         paths[ pos++ ] = st_AutoResourceDir;
00696     else if ( st_ResourceDir.Len() > 1 )
00697         paths[ pos++ ] = st_ResourceDir + "/automatic";
00698     else if ( st_UserDataDir.Len() > 1 )
00699         paths[ pos++ ] = st_UserDataDir + "/resource/automatic";
00700     else
00701         paths[ pos++ ] = st_DataDir + "/resource/automatic";
00702 
00703     paths[ pos++ ] = st_DataDir + "/resource/included";
00704     if ( st_IncludedResourceDir.Len() > 1 )
00705         paths[ pos++ ] = st_IncludedResourceDir;
00706 
00707     paths[ pos++ ] = st_DataDir + "/resource";
00708     if ( st_UserDataDir.Len() > 1 )
00709         paths[ pos++ ] = st_UserDataDir + "/resource";
00710     if ( st_ResourceDir.Len() > 1 )
00711         paths[ pos++ ] = st_ResourceDir;
00712 }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:58:03 2008 for Armagetron Advanced by  doxygen 1.5.4