BOOL CEmptyProjectTemplateItem::InitProject(CLaTeXProject *pProject, LPCTSTR lpszCr)
{
	CString strTargetPath(pProject->GetMainPath());

	if (CPathTool::Exists(strTargetPath))
	{
		CString strMessage;
		strMessage.Format(STE_PROJECT_MAINFILEEXISTS, strTargetPath);
		if (AfxMessageBox(strMessage, MB_ICONWARNING | MB_YESNO) == IDNO)
		{
			if (AfxMessageBox(STE_PROJECT_USEEXISTINGFILE, MB_ICONQUESTION | MB_YESNO) == IDNO)
				return FALSE;
			else
				return TRUE;
		}
	}

	if (!CreateMainFile(strTargetPath, lpszCr))
	{
		AfxMessageBox(STE_PROJECT_CANNOTCREATEMAINFILE, MB_ICONSTOP | MB_OK);
		return FALSE;
	}

	return TRUE;
}
Пример #2
0
UIDownloaderExtensionPack::UIDownloaderExtensionPack()
{
    /* Prepare instance: */
    if (!m_spInstance)
        m_spInstance = this;

    /* Prepare source/target: */
    QString strExtPackUnderscoredName(QString(GUI_ExtPackName).replace(' ', '_'));
    QString strTemplateSourcePath("http://download.virtualbox.org/virtualbox/%1/");
    QString strTemplateSourceName(QString("%1-%2.vbox-extpack").arg(strExtPackUnderscoredName));
    QString strSourcePath(strTemplateSourcePath.arg(vboxGlobal().vboxVersionStringNormalized()));
    QString strSourceName(strTemplateSourceName.arg(vboxGlobal().vboxVersionStringNormalized()));
    QString strSource(strSourcePath + strSourceName);
    QString strTargetPath(vboxGlobal().homeFolder());
    QString strTargetName(strSourceName);
    QString strTarget(QDir(strTargetPath).absoluteFilePath(strTargetName));

    /* Set source/target: */
    setSource(strSource);
    setTarget(strTarget);
}
Пример #3
0
std::string prepareTargetPath(const char* targetPath, const char* firstFileName)
{
    INFO("%s", "Preparing the zip file name.");
    std::string strTargetPath(targetPath);
    if (strTargetPath.find(".zip") == std::string::npos)
    {
        std::string zipTarget;
        std::string zipFileName;
        std::string strFirstFile(firstFileName);
        zipFileName = getFileName(strFirstFile);
        unsigned found = zipFileName.find_last_of(".");
        zipTarget = zipFileName.substr(0, found);
        if (*strTargetPath.rbegin() != '/')
            strTargetPath.append("/");

        strTargetPath.append(zipTarget);
        strTargetPath.append(".zip");
    }
    INFO("The output zip file will be: %s", strTargetPath.c_str());
    return strTargetPath;
}