Ejemplo n.º 1
0
cpidl_t CSftpDirectory::CreateDirectory(const wstring& name)
{
    bstr_t target_path = (m_directory / name).string();

    cpidl_t sub_directory = create_remote_itemid(
        name, true, false, L"", L"", 0, 0, 0, 0, datetime_t::now(),
        datetime_t::now());

    m_provider->create_new_directory(m_consumer.in(), target_path.in());

    try
    {
        // Must not report a failure after this point.  The folder was created 
        // even if notifying the shell fails.

        // TODO: stat new folder for actual parameters

        notify_shell_created_directory(m_directory_pidl + sub_directory);
    }
    catch (const exception& e)
    {
        trace("WARNING: Couldn't notify shell of new folder: %s") % e.what();
    }

    return sub_directory;
}
Ejemplo n.º 2
0
void CSftpDirectory::Delete(const cpidl_t& file)
{
    bstr_t target_path =
        (m_directory / remote_itemid_view(file).filename()).string();
    
    m_provider->remove_all(target_path.in());

    try
    {
        // Must not report a failure after this point.  The item was deleted
        // even if notifying the shell fails.

        notify_shell_of_deletion(m_directory_pidl, file);
    }
    catch (const exception& e)
    {
        trace("WARNING: Couldn't notify shell of deletion: %s") % e.what();
    }

}