Пример #1
0
bool iniWorkEnv(map<string,string>& DIR, const string workDirName) 
{
  cout << "[INFO] Initializing the work enviroment" << endl;
  DIR["main"]   = gSystem->ExpandPathName(gSystem->pwd());
  DIR["macros"] = DIR["main"] + "/Macros/";
  if (existDir(DIR["macros"].c_str())==false){ 
    cout << "[ERROR] Input directory: " << DIR["macros"] << " does not exist!" << endl; 
    return false; 
  }     
  DIR["input"]  = DIR["main"] + "/Input/" + workDirName + "/";
  if (existDir(DIR["input"])==false){ 
    cout << "[ERROR] Input directory: " << DIR["input"] << " does not exist!" << endl; 
    return false; 
  }     
  DIR["output"] = DIR["main"] + "/Output/" + workDirName + "/";
  if (existDir(DIR["output"].c_str())==false){ 
    cout << "[INFO] Output directory: " << DIR["output"] << " does not exist, will create it!" << endl;  
    gSystem->mkdir(DIR["output"].c_str(), kTRUE);
  }
  DIR["dataset"] = DIR["main"] + "/DataSet/";
  if (existDir(DIR["dataset"])==false){ 
    cout << "[INFO] DataSet directory: " << DIR["dataset"] << " does not exist, will create it!" << endl;  
    gSystem->mkdir(DIR["dataset"].c_str(), kTRUE);
  }
  return true; 
};
Пример #2
0
static void Main2(char *tmplProject, char *tmplDir, int utFlag, int m2Flag)
{
	char *project = nextArg();

	errorCase(!existDir(tmplDir)); // 2bs ?

	errorCase_m(!lineExp("<1,30,__09AZaz>", project), "不正なプロジェクト名です。");
	errorCase_m(existPath(project), "既に存在します。");

	createDir(project);
	copyDir(tmplDir, project);

	addCwd(project);
	{
		coExecute("qq -f");

		RenamePaths(tmplProject, project);

		addCwd(existDir(TESTER_PROJ_LDIR) ? TESTER_PROJ_LDIR : project);
		{
			ChangeAppIdent("Program.cs");

			if(utFlag)
			{
				char *csprojFile = xcout("%s.csproj", project);

				if(existFile(csprojFile))
				{
					ResolveRelHintPath(csprojFile);
				}
				memFree(csprojFile);
			}
		}
		unaddCwd();

		removeFileIfExist("C:\\Factory\\tmp\\Sections.txt"); // 意図しない検索結果を trep しないように、念のため検索結果をクリア

		coExecute_x(xcout("Search.exe %s", tmplProject));
		coExecute_x(xcout("trep.exe /F %s", project));

//		execute("START .");

		execute_x(xcout("%s.sln", project));

		if(m2Flag)
			execute("START C:\\Dev\\CSharp\\Module2\\Module2");
	}
	unaddCwd();
}
Пример #3
0
static void ShowBuildTime(char *trgPath)
{
	trgPath = makeFullPath(trgPath);

	if(existDir(trgPath))
	{
		autoList_t *paths = lss(trgPath);
		char *path;
		uint index;

		sortJLinesICase(paths);

		foreach(paths, path, index)
		{
			char *relPath = changeRoot(strx(path), trgPath, NULL);

			if(existDir(path))
			{
				cout("------------------------ %s\n", relPath);
			}
			else if(
				!_stricmp("exe", getExt(path)) ||
				!_stricmp("dll", getExt(path)) ||
				!_stricmp("exe_", getExt(path)) ||
				!_stricmp("dll_", getExt(path))
				)
			{
				ShowBuildTime_File(path, relPath);
			}
			else
			{
				char *hash = md5_makeHexHashFile(path);

				hash[16] = '\0';

				cout("    %s     %s\n", hash, relPath);

				memFree(hash);
			}
			memFree(relPath);
		}
		releaseDim(paths, 1);
	}
Пример #4
0
    std::vector<std::string> getFilesOnDirectory(const std::string& directoryPath,
                                                 const std::vector<std::string>& extensions)
    {
        try
        {
            // Check folder exits
            if (!existDir(directoryPath))
                error("Folder " + directoryPath + " does not exist.", __LINE__, __FUNCTION__, __FILE__);
            // Read images
            std::vector<std::string> filePaths;
            for (const auto& file : boost::make_iterator_range(boost::filesystem::directory_iterator{directoryPath}, {}))
                if (!boost::filesystem::is_directory(file.status()))                // Skip directories
                    filePaths.emplace_back(file.path().string());
            // Check #files > 0
            if (filePaths.empty())
                error("No files were found on " + directoryPath, __LINE__, __FUNCTION__, __FILE__);

            // If specific extensions specified
            if (!extensions.empty())
            {
                // Read images
                std::vector<std::string> specificExtensionPaths;
                specificExtensionPaths.reserve(filePaths.size());
                for (const auto& filePath : filePaths)
                    if (extensionIsDesired(getFileExtension(filePath), extensions))
                        specificExtensionPaths.emplace_back(filePath);
                std::swap(filePaths, specificExtensionPaths);
            }

            // Sort alphabetically
            std::sort(filePaths.begin(), filePaths.end());

            return filePaths;
        }
        catch (const std::exception& e)
        {
            error(e.what(), __LINE__, __FUNCTION__, __FILE__);
            return {};
        }
    }
Пример #5
0
int main(int argc, char **argv)
{
	int changed = 0;

	if(argIs("/D"))
	{
		GameDir = nextArg();
		goto readArgs;
	}

	// Check 'GameDir'
	{
		char *file;

		errorCase_m(!existDir(GameDir), "Wrong Game-Dir");

		file = combine(GameDir, "koumajou.exe");
		errorCase_m(!existFile(file), "Wrong Game-Dir, koumajou.exe does not exist!");
		memFree(file);

		file = combine(GameDir, "data");
		errorCase_m(!existDir(file), "Wrong Game-Dir, data does not exist!");
		memFree(file);
	}

	LoadSaveData();
	ShowSaveData();

readArgs:
	if(argIs("/S"))
	{
		StageNo = toValue(nextArg());
		changed = 1;
		goto readArgs;
	}
	if(argIs("/H"))
	{
		HiScore = toValue(nextArg());
		changed = 1;
		goto readArgs;
	}
	if(argIs("/E+"))
	{
		ExtraOpened = 1;
		changed = 1;
		goto readArgs;
	}
	if(argIs("/E-"))
	{
		ExtraOpened = 0;
		changed = 1;
		goto readArgs;
	}

	if(changed)
	{
		cout(">\n");

		ShowSaveData();
		OutputSaveData();
	}
}