EssGetLocalPath

Gets the full local file path for a specific object file on the client.

Syntax

ESS_FUNC_M EssGetLocalPath (hCtx, ObjType, AppName, DbName, ObjName, Create, pPath);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle returned by EssCreateLocalContext()

ObjType

ESS_OBJTYPE_T

Object type (must be single type). See Bitmask Data Types (C) for a list of object types.

AppName

ESS_STR_T

Application name or NULL (ESS_NULL). If NULL, command assumes a file name, and EssGetLocalPath() returns the ObjName in pPath as is.

DbName

ESS_STR_T

Database name. If NULL, uses the application subdirectory.

ObjName

ESS_STR_T

Object name or file name if AppName is NULL ObjName is not parsed for correctness; no suffix is appended to the path.

Create

ESS_BOOL_T

Create directories flag. If TRUE, the appropriate application and database sub-directories will be created if necessary. If FALSE, and the directories do not exist, an error will be generated.

pPath

ESS_PSTR_T

Address of pointer to receive allocated local path name string

Notes

The memory allocated for pPath should be freed using EssFree().

Return Value

If successful, returns the full path name of the appropriate object file in pPath.

Access

This function requires no special privileges.

Example

ESS_VOID_T 
ESS_GetLocalPath (ESS_HINST_T hInst)
{ 
   ESS_FUNC_M         sts = ESS_STS_NOERR;   
   ESS_HCTX_T        hLocalCtx;
   ESS_STR_T         AppName;
   ESS_STR_T         DbName;
   ESS_STR_T         ObjName;       
   ESS_OBJTYPE_T     ObjType;   
   ESS_BOOL_T        Create;   
   ESS_STR_T         Path;
   
   AppName = "Sample";
   DbName  = "Basic";         
   ObjName = "Basic";
   ObjType = ESS_OBJTYPE_OUTLINE;
   Create  = ESS_TRUE;
   sts = EssCreateLocalContext(hInst, NULL, NULL, 
        &hLocalCtx);
   if(!sts && hLocalCtx)
   {
      sts = EssGetLocalPath(hLocalCtx, ObjType,
         AppName, DbName, ObjName, Create, &Path);
      if(!sts)
      {
         if(*Path)
         {
            printf("Path: %s\r\n",Path);
            EssFree(hInst,Path);
         }
      }
   } 
   
   if(hLocalCtx)
      sts = EssDeleteLocalContext(hLocalCtx);                                    
}

See Also