2.2.4.13.8 Folder::GetFolder

Description

Return a folder object from its name

Syntax

Folder GetFolder( LPCSTR strPathName )

Parameters

strPathName
[input] Path as string

Return

Returns a Folder object

Examples

EX1

// "/name", use absolute search. The project can be omitted in this method.
// "../name", use relative search. Find folder name as "name" from current folder's parents' folder.
// Demonstrate getting a folder via each kind of path reference string
void Folder_GetFolder_Ex1()
{
    // Create two subfolders off root folder
    Folder fldRoot("/");
    fldRoot.AddSubfolder("MyFolder1");
    Folder fldMyFolder1("/MyFolder1");
    fldRoot.AddSubfolder("MyFolder2");
    Folder fldMyFolder2("/MyFolder2");
    // Attach to a subfolder of root using an absolute reference string
    Folder fldCurr = fldRoot.GetFolder("/MyFolder1");
    string strCurrName = fldCurr.GetName();
    printf("The current folder is %s\n", strCurrName);
    // Attach to a sibling folder of MyFolder1 using a relative string reference
    fldCurr = fldMyFolder1.GetFolder("../MyFolder2");
    strCurrName = fldCurr.GetName();
    printf("The current folder is %s", strCurrName);
}

Remark

You can use relative and absolute ways to Get a Folder. The name is not case sensitive.

See Also

OriginC:Folder::AddFolder

Header to Include

origin.h