Пример #1
0
bool CreateRepositoryCommand::Execute()
{
    if (!SVN::CreateRepository(cmdLinePath))
    {
        TSVNMessageBox(GetExplorerHWND(), IDS_PROC_REPOCREATEERR, IDS_APPNAME, MB_ICONERROR);
        return false;
    }
    else
    {
        // create a desktop.ini file which sets our own icon for the repo folder
        // we extract the icon to use from the resources and write it to disk
        // so even those who don't have TSVN installed can benefit from it.
        CIconExtractor svnIconResource;
        if (svnIconResource.ExtractIcon(NULL, MAKEINTRESOURCE(IDI_SVNFOLDER), cmdLinePath.GetWinPathString() + _T("\\svn.ico")) == 0)
        {
            DWORD dwWritten = 0;
            CAutoFile hFile = CreateFile(cmdLinePath.GetWinPathString() + _T("\\Desktop.ini"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN, NULL);
            if (hFile)
            {
                CString sIni = _T("[.ShellClassInfo]\nConfirmFileOp=0\nIconFile=svn.ico\nIconIndex=0\nInfoTip=Subversion Repository\n");
                WriteFile(hFile, (LPCTSTR)sIni,  sIni.GetLength()*sizeof(TCHAR), &dwWritten, NULL);
            }
            PathMakeSystemFolder(cmdLinePath.GetWinPath());
        }

        CWnd parent;
        parent.FromHandle(GetExplorerHWND());
        CRepoCreationFinished finDlg(&parent);
        finDlg.SetRepoPath(cmdLinePath);
        finDlg.DoModal();
    }
    return true;
}
Пример #2
0
CFilePath &CFilePath::MakeSystemFolder(BOOL bMake)
{
    BOOL bRetCode = bMake ? PathMakeSystemFolder(msPath) != 0 : PathUnmakeSystemFolder(msPath) != 0;
    if (bRetCode)
        SetLastError(0);

    return *this;
}