2.1.10.46 okutil_get_origin_path_type
Contents
Description
Returns path type from the enum ORIGIN_PATH_TYPE, given a full path
Syntax
int okutil_get_origin_path_type( LPCSTR lpcszFilePath, BOOL bPreferUser = TRUE )
Parameters
- lpcszFilePath
- [input] a full path to a folder or file. Include backslash if it is a folder.
- bPreferUser
- [input] if User path equals System path, then return ORIGIN_PATH_USER if bPreferUser is TRUE
Return
Return an integer in the ORIGIN_PATH_TYPE enumeration.
Returns ORIGIN_PATH_UNDEF if the path is not in Origin's System, User or Group folders.
Examples
EX1
void get_origin_path_type_ex1() { //-- to illustrate, first use okutil_get_origin_path to get some origin paths on your computer string strPath1 = okutil_get_origin_path(ORIGIN_PATH_USER, "Themes\\Graph") + "file.ext";// this file need not exist on your computer. string strPath2 = okutil_get_origin_path(ORIGIN_PATH_SYSTEM, "Themes\\Graph") + "file.ext";// this file need not exist on your computer. // next, get the path type from the string strPath. The path can be a file path or just a path to a folder. The file or folder need not exist. int nPathType = okutil_get_origin_path_type(strPath1); if(ORIGIN_PATH_USER==nPathType) printf("The path %s has path type ORIGIN_PATH_USER\n", strPath1); nPathType = okutil_get_origin_path_type(strPath2); if(ORIGIN_PATH_SYSTEM==nPathType) printf("The path %s has path type ORIGIN_PATH_SYSTEM\n", strPath2); // Note: If User path and system path are the same (i.e. okutil_get_origin_path(ORIGIN_PATH_USER) // and okutil_get_origin_path(ORIGIN_PATH_SYSTEM) are equal), then // get_origin_path_type(strPath); returns ORIGIN_PATH_USER and // get_origin_path_type(strPath, FALSE); returns ORIGIN_PATH_SYSTEM }
Remark
See Also
Header to Include
origin.h