Ejemplo n.º 1
0
NodeCategory
ClassifyNode(const Path& pth)
{
    if(pth.empty())
        return NodeCategory::Empty;

    const auto& fname(pth.back());

    switch(ystdex::classify_path<String, PathTraits>(fname))
    {
    case ystdex::path_category::empty:
        return NodeCategory::Empty;
    case ystdex::path_category::self:
    case ystdex::path_category::parent:
        break;
    default:
        if(ufexists(string(pth).c_str()))
            return VerifyDirectory(pth)
                   ? NodeCategory::Directory : NodeCategory::Regular;
        else
            return NodeCategory::Missing;
        // TODO: Implementation for other categories.
    }
    return NodeCategory::Unknown;
}
Ejemplo n.º 2
0
void
EnsureDirectory(const Path& pth)
{
    string upath;

    for(const auto& name : pth)
    {
        upath += MakeMBCS(name.c_str()) + YCL_PATH_DELIMITER;
        if(!VerifyDirectory(upath) && !umkdir(upath.c_str()) && errno != EEXIST)
        {
            YTraceDe(Err, "Failed making directory path '%s'", upath.c_str());
            ystdex::throw_error(errno);
        }
    }
}
Ejemplo n.º 3
0
/**
 * Open the OS-native folder viewer.
 * Note: Since this is the native viewer, this is not modal.
 * The parent window handle is for the alert dialogs and prompts.
 * @param parentWnd The parent window handle.
 */
void FolderViewer::Show(OS::wnd_t parentWnd)
{
	if (VerifyDirectory(parentWnd)) {
		OS::OpenPath(path);
	}
}