Logo Search packages:      
Sourcecode: icu version File versions

U_STABLE const char* U_EXPORT2 u_getDataDirectory ( void   ) 

Platform utilities isolates the platform dependencies of the libarary. For each platform which this code is ported to, these functions may have to be re-implemented. Return the ICU data directory. The data directory is where common format ICU data files (.dat files) are loaded from. Note that normal use of the built-in ICU facilities does not require loading of an external data file; unless you are adding custom data to ICU, the data directory does not need to be set.

The data directory is determined as follows: If u_setDataDirectory() has been called, that is it, otherwise if the ICU_DATA environment variable is set, use that, otherwise If a data directory was specifed at ICU build time

        #define ICU_DATA_DIR "path" 
use that, otherwise no data directory is available.

Returns:
the data directory, or an empty string ("") if no data directory has been specified.
ICU 2.0

Definition at line 1099 of file putil.c.

References NULL.

                         {
    const char *path = NULL;

    /* if we have the directory, then return it immediately */
    UMTX_CHECK(NULL, gDataDirectory, path);

    if(path) {
        return path;
    }

    /*
    When ICU_NO_USER_DATA_OVERRIDE is defined, users aren't allowed to
    override ICU's data with the ICU_DATA environment variable. This prevents
    problems where multiple custom copies of ICU's specific version of data
    are installed on a system. Either the application must define the data
    directory with u_setDataDirectory, define ICU_DATA_DIR when compiling
    ICU, set the data with udata_setCommonData or trust that all of the
    required data is contained in ICU's data library that contains
    the entry point defined by U_ICUDATA_ENTRY_POINT.

    There may also be some platforms where environment variables
    are not allowed.
    */
#   if !defined(ICU_NO_USER_DATA_OVERRIDE) && !UCONFIG_NO_FILE_IO
    /* First try to get the environment variable */
    path=getenv("ICU_DATA");
#   endif

    /* ICU_DATA_DIR may be set as a compile option */
#   ifdef ICU_DATA_DIR
    if(path==NULL || *path==0) {
        path=ICU_DATA_DIR;
    }
#   endif

    if(path==NULL) {
        /* It looks really bad, set it to something. */
        path = "";
    }

    u_setDataDirectory(path);
    return gDataDirectory;
}


Generated by  Doxygen 1.6.0   Back to index