void ProblemZipper::accept()
{
	MakeListOfFilesToUse(m_FromDir);
	QString pathToProjectFolder = MakeProjectDirectory();
	if(!pathToProjectFolder.isEmpty()) {
		QDesktopServices::openUrl(QUrl("file:///" + pathToProjectFolder));
		ZipFolder(pathToProjectFolder);
	}
	QDialog::accept();
}
Example #2
0
/*----------------------------------------------------------------------------*/
int JobProc(char* sPath)
/*----------------------------------------------------------------------------*/
{
	BOOL flag = TRUE;

	if (flag)
	{
		/*
		 * 폴더명을 이용한 폴더 압축
		 */
		
		DIR* pDp;
		struct dirent* pDirEnt;
		struct stat    st;
		char sSubPath[128];
		char sFile[128];

		pDp = opendir(sPath);

		while ( TRUE )
		{
			pDirEnt = readdir(pDp);
			if (pDirEnt == NULL)
				break;

			/* 관련없는 폴더는 걸러낸다. */
			if (!strcmp(pDirEnt->d_name, ".") || !strcmp(pDirEnt->d_name, ".."))
				continue;

			/* 비교일자 이후이면 넘어간다. */
			if (strcmp(sComp, pDirEnt->d_name) <= 0)
				continue;

			/* sub folder에 대한 정보를 얻는다. */
			sprintf(sSubPath, "%s/%s", sPath, pDirEnt->d_name);
			lstat(sSubPath, &st);

			if (!flag) LOG(_FL_, 0, 0, "[%s:%d] 압축 시작", sSubPath, st.st_mtime);

			ZipFolder(sSubPath);

			if (!flag) break;
		}

		closedir(pDp);
	}

	if (!flag)
	{
		/*
		 * 폴더의 시간을 이용한 폴더 압축
		 */
		DIR* pDp;
		struct dirent* pDirEnt;
		struct stat    st;
		char sSubPath[128];
		char sFile[128];

		pDp = opendir(sPath);

		while ( TRUE )
		{
			pDirEnt = readdir(pDp);
			if (pDirEnt == NULL)
				break;

			/* 관련없는 폴더는 걸러낸다. */
			if (!strcmp(pDirEnt->d_name, ".") || !strcmp(pDirEnt->d_name, ".."))
				continue;

			/* sub folder에 대한 정보를 얻는다. */
			sprintf(sSubPath, "%s/%s", sPath, pDirEnt->d_name);
			lstat(sSubPath, &st);

			if (!flag) LOG(_FL_, 0, 0, "[%s:%d] %s"
				, sSubPath
				, st.st_mtime
				, (st.st_mtime < tmComp ? "압축 시작" : "-")
				);

			if (st.st_mtime < tmComp)
			{
				if (!flag) LOG(_FL_, 0, 0, "[%s:%d] 압축 시작", sSubPath, st.st_mtime);

				ZipFolder(sSubPath);
			}

			if (!flag) break;
		}

		closedir(pDp);
	}

	return 0;
}