<commit_before>#include "C:\Factory\Common\all.h"

static void RemoveFileEx(char *file)
{
	cout("rf: %s\n", file);
	remove(file);
}
static void RemoveDirEx(char *dir)
{
	cout("rd: %s\n", dir);
	execute_x(xcout("RD /S /Q \"%s\"", dir));
}
static void ClearDirEx(char *dir)
{
	cout("clearDir: %s\n", dir);
	execute_x(xcout("RD /S /Q \"%s\"", dir));
	execute_x(xcout("MD \"%s\"", dir));
}

// ---- Java ----

static void CleanJavaProject(char *file) // file - JavavWFNgt@C
{
	char *dir = getParent(file);

	cout("CleanJavaProject: %s\n", file);

	addCwd(dir);
	ClearDirEx("bin");
	unaddCwd();

	memFree(dir);
}
static void FindCleanJava(autoList_t *files)
{
	char *file;
	uint index;

	foreach(files, file, index)
	{
		if(!_stricmp(getLocal(file), ".project"))
		{
			char *cpFile = changeLocal(file, ".classpath");

			if(existFile(cpFile))
			{
				CleanJavaProject(file);
			}
			memFree(cpFile);
		}
	}
}

// ----

static void CleanProject(char *file) // file - vWFNgt@C
{
	char *dir = getParent(file);
	char *userWCard = xcout("%s.*.user", getLocal(file));

	cout("CleanProject: %s\n", file);

	addCwd(dir);

	// vb2008
	// vcs2008
	RemoveDirEx("bin");
	RemoveDirEx("obj");

	// vc2008
	RemoveDirEx("Debug");
	RemoveDirEx("Release");
//	execute_x(xcout("DEL \"%s\"", userWCard)); // s̃JgȂǂ̏񂪓Ă̂ŏȂB

	unaddCwd();

	memFree(dir);
	memFree(userWCard);
}
static void FindCleanProjects(char *dir) // dir - \[Ṽ[gDIR
{
	autoList_t *files = lssFiles(dir);
	char *file;
	uint index;

	foreach(files, file, index)
	{
		if(
			!_stricmp("vbproj", getExt(file)) || // vb2008, vb2010
			!_stricmp("vcproj", getExt(file)) || // vc2008
			!_stricmp("vcxproj", getExt(file)) || // vc2010
			!_stricmp("csproj", getExt(file)) || // vcs2008, vcs2010
			0
			)
		{
			CleanProject(file);
		}
	}
	releaseDim(files, 1);
}
static void CleanSolution(char *file) // file - \[Vt@C
{
	char *dir = getParent(file);
	char *ncbFile = changeExt(getLocal(file), "ncb"); // 2008
	char *suoFile = changeExt(getLocal(file), "suo"); // 2008, 2010
	char *sdfFile = changeExt(getLocal(file), "sdf"); // 2010
	char *opensdfFile = changeExt(getLocal(file), "opensdf"); // 2010 (tmp)

	cout("CleanSolution: %s\n", file);

	addCwd(dir);

	// vc2008
	RemoveDirEx("Debug");
	RemoveDirEx("Release");
	RemoveFileEx(ncbFile);

	// vb2008
	// vc2008
	// vcs2008
	RemoveFileEx(suoFile);

	// vc2010
	RemoveDirEx("ipch");
	RemoveFileEx(sdfFile);
	RemoveFileEx(opensdfFile);

	unaddCwd();

	FindCleanProjects(dir);

	memFree(dir);
	memFree(ncbFile);
	memFree(suoFile);
	memFree(sdfFile);
}
static void FindClean(char *dir) // dir - [gDIR
{
	autoList_t *files;
	char *file;
	uint index;

	dir = makeFullPath(dir);
	cout("RootDir: %s\n", dir);
	errorCase(!existDir(dir));

	files = lssFiles(dir);

	foreach(files, file, index)
	{
		if(!_stricmp("sln", getExt(file))) // ? \[Vt@C
		{
			CleanSolution(file);
		}
	}
	FindCleanJava(files);

	releaseDim(files, 1);
	memFree(dir);

	cout("\\e\n");
}
int main(int argc, char **argv)
{<commit_msg>coffee break<commit_after>#include "C:\Factory\Common\all.h"

static void RemoveFileEx(char *file)
{
	cout("rf: %s\n", file);
	remove(file);
}
static void RemoveDirEx(char *dir)
{
	cout("rd: %s\n", dir);
	execute_x(xcout("RD /S /Q \"%s\"", dir));
}
static void ClearDirEx(char *dir)
{
	cout("clearDir: %s\n", dir);
	execute_x(xcout("RD /S /Q \"%s\"", dir));
	execute_x(xcout("MD \"%s\"", dir));
}

// ---- Java ----

static void CleanJavaProject(char *file) // file - JavavWFNgt@C
{
	char *dir = getParent(file);

	cout("CleanJavaProject: %s\n", file);

	addCwd(dir);
	ClearDirEx("bin");
	unaddCwd();

	memFree(dir);
}
static void FindCleanJava(autoList_t *files)
{
	char *file;
	uint index;

	foreach(files, file, index)
	{
		if(!_stricmp(getLocal(file), ".project"))
		{
			char *cpFile = changeLocal(file, ".classpath");

			if(existFile(cpFile))
			{
				CleanJavaProject(file);
			}
			memFree(cpFile);
		}
	}
}

// ----

static void CleanProject(char *file) // file - vWFNgt@C
{
	char *dir = getParent(file);
	char *userWCard = xcout("%s.*.user", getLocal(file));

	cout("CleanProject: %s\n", file);

	addCwd(dir);

	// vb2008
	// vcs2008
	RemoveDirEx("bin");
	RemoveDirEx("obj");

	// vc2008
	RemoveDirEx("Debug");
	RemoveDirEx("Release");
//	execute_x(xcout("DEL \"%s\"", userWCard)); // s̃JgȂǂ̏񂪓Ă̂ŏȂB

	unaddCwd();

	memFree(dir);
	memFree(userWCard);
}
static void FindCleanProjects(char *dir) // dir - \[Ṽ[gDIR
{
	autoList_t *files = lssFiles(dir);
	char *file;
	uint index;

	foreach(files, file, index)
	{
		if(
			!_stricmp("vbproj", getExt(file)) || // vb2008, vb2010
			!_stricmp("vcproj", getExt(file)) || // vc2008
			!_stricmp("vcxproj", getExt(file)) || // vc2010
			!_stricmp("csproj", getExt(file)) || // vcs2008, vcs2010
			0
			)
		{
			CleanProject(file);
		}
	}
	releaseDim(files, 1);
}
static void CleanSolution(char *file) // file - \[Vt@C
{
	char *dir = getParent(file);
	char *ncbFile = changeExt(getLocal(file), "ncb"); // 2008
	char *suoFile = changeExt(getLocal(file), "suo"); // 2008, 2010
	char *sdfFile = changeExt(getLocal(file), "sdf"); // 2010
	char *opensdfFile = changeExt(getLocal(file), "opensdf"); // 2010 (tmp)
	char *vcdbFile = changeExt(getLocal(file), "VC.db"); // vc2015

	cout("CleanSolution: %s\n", file);

	addCwd(dir);

	// vc2008
	RemoveDirEx("Debug");
	RemoveDirEx("Release");
	RemoveFileEx(ncbFile);

	// vb2008
	// vc2008
	// vcs2008
	RemoveFileEx(suoFile);

	// vc2010
	RemoveDirEx("ipch");
	RemoveFileEx(sdfFile);
	RemoveFileEx(opensdfFile);

	// vs2015
	RemoveDirEx(".vs");
	RemoveFileEx(vcdbFile); // vc2015

	unaddCwd();

	FindCleanProjects(dir);

	memFree(dir);
	memFree(ncbFile);
	memFree(suoFile);
	memFree(sdfFile);
	memFree(vcdbFile);
}
static void FindClean(char *dir) // dir - [gDIR
{
	autoList_t *files;
	char *file;
	uint index;

	dir = makeFullPath(dir);
	cout("RootDir: %s\n", dir);
	errorCase(!existDir(dir));

	files = lssFiles(dir);

	foreach(files, file, index)
	{
		if(!_stricmp("sln", getExt(file))) // ? \[Vt@C
		{
			CleanSolution(file);
		}
	}
	FindCleanJava(files);

	releaseDim(files, 1);
	memFree(dir);

	cout("\\e\n");
}
int main(int argc, char **argv)
{
{'fraction_non_alphanumeric': 0.20208775077475127, 'fraction_numerical': 0.027727939977165227, 'mean_word_length': 4.11, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1312279', 'n_tokens_mistral': 2825, 'n_tokens_neox': 2548, 'n_words': 471}