GetOriginPath

 

Description

Get Origin program path or user file path or group path.

Syntax

string GetOriginPath( int nPathType = ORIGIN_PATH_SYSTEM, bool bCheckExistsAndDiffFromUserPath = false )

Parameters

nPathType
[input] can be one of the following enum constants
typedef enum tagORIGIN_PATH_TYPE
{
ORIGIN_PATH_SYSTEM,
ORIGIN_PATH_USER,
ORIGIN_PATH_GROUP,
ORIGIN_PATH_SERVER_GROUP_FOLDER,
}
The default value is ORIGIN_PATH_SYSTEM.
bCheckExistsAndDiffFromUserPath
if false, the folder is retured whether it exists or not.
if true, then the function will return empty string if
1) the folder does not exist
or
2) it exists but is equal to the USER path AND nPathType!=ORIGIN_PATH_USER.
(bCheckExistsAndDiffFromUserPath has no effect if nPathType=ORIGIN_PATH_USER)
Set to true if searching ORIGIN_PATH_USER folder first, then other folders, and you don't want to bother searching if not needed.

Return

A string containing the requested path, including the final backslash.

Examples

EX1

void    GetOriginPath_ex1()
{
    string strFile = GetOriginPath(ORIGIN_PATH_SYSTEM) + "originc\\system\\wksheet.h";
    ASSERT(strFile.IsFile());  // system header should be installed only in program path
    strFile = GetOriginPath(ORIGIN_PATH_USER) + "originc\\system\\wksheet.h";
    ASSERT(!strFile.IsFile()); // should not have this in user files path
    strFile = GetOriginPath() + "origin.ini";
    ASSERT(strFile.IsFile());
}

Remark

Get one of 3 main Origin paths: System, User or Group paths, including final backslash character.

Origin's system path is where Origin's EXE and DLL files are located. Origin C system files are always installed inside the program path.

Origin's User path is assigned by the user when running Origin for the first time. This is where all the files related to a particular customization of Origin is located. You will find origin.ini and other templates and CNF files in this location.

Origin's Group path is where files shared between users are located. ORIGIN_PATH_GROUP : get the path of group folder in Member Machine; ORIGIN_PATH_SERVER_GROUP_FOLDER : get the path of group folder in Group Leader Machine.

See Also

header to Include

origin.h

Reference