Directory Info

Availability LightWave 6.0 | Component Layout, Modeler | Header lwhost.h

The function returned by the directory info global gives plug-ins read-only access to LightWave's internal directory list. This tells you where LightWave would look first for a given item. It can be used to set the initial path for a file request.

Global Call

   LWDirInfoFunc *dirinfo;
   dirinfo = global( LWDIRINFOFUNC_GLOBAL, GFUSE_TRANSIENT );

The global function returns a pointer to an LWDirInfoFunc.

   typedef const char * LWDirInfoFunc (const char *dirtype);

The dirtype argument identifies which directory path should be returned by the directory info function. It can be any of the predefined file type strings. The paths returned may be relative rather than absolute. In most cases, relative paths will be relative to the content directory. Also, in some cases, the path may be NULL.

Example

This code fragment initializes a path string with the default directory for images.

   #include <lwserver.h>
   #include <lwhost.h>

   #define MAXFILESZ 260

   char *imgdir, path[ MAXFILESZ ] = "";
   LWDirInfoFunc *dirinfo;

   dirinfo = global( LWDIRINFOFUNC_GLOBAL, GFUSE_TRANSIENT );
   if ( dirinfo ) {
      imgdir = dirinfo( LWFTYPE_IMAGE );
      if ( imgdir )
         if ( strlen( imgdir ) < MAXFILESZ )
            strcpy( path, imgdir );
   }
   ...