예제 #1
0
파일: resmgr.hpp 프로젝트: calref/cboe
		/// Convert a relative path to an absolute path by checking the current search path stack.
		/// @param path The path to resolve.
		/// @return The resolved absolute path, or the relative path unchanged if resolution failed.
		static fs::path find(std::string name, std::string ext) {
			fs::path path = name + "." + ext;
			std::stack<fs::path> tmpPaths = resPaths();
			while(!tmpPaths.empty()) {
				fs::path thisPath = tmpPaths.top()/path;
				if(fs::exists(thisPath)) {
					pathFound()[name] = thisPath;
					return thisPath;
				}
				tmpPaths.pop();
			}
			// If we got this far, it wasn't found.
			// Just return the original filename unchanged;
			// maybe it can be resolved anyway.
			return path;
		}
예제 #2
0
파일: a11.C 프로젝트: schambersnh/school
int main(int argc, const char * argv[])
{
	int numChambers = 0;
	int teleportId = 0;
	bool printMaze = false;
	ifstream f1;

	/*The following code tests the command line arguments. If an invalid ammount is supplied,
	the program aborts. If the dump switch is there, it tells the program later on to print
	out the maze. If the graph file cannot be opened, the program is exited.*/

	//////////////////////////////////////////////////////////////////////////////////////
	if(argc < 2 || argc > 3)
	{
		cout << "Invalid amount of command line arguments, exiting program" << endl;
		exit(1);
	}
	if(strcmp(argv[1], "-d") == 0)
	{
		f1.open(argv[2]);
		printMaze = true;
	}
	else
	{
		f1.open(argv[1]);
	}
	if(!f1)
	{
		cout << "Graph file failed to open, exiting program " << endl;
		exit(1);
	}
	/////////////////////////////////////////////////////////////////////////////////////////
	f1 >> numChambers;
	Graph g(numChambers);
	createGraph(numChambers, g, f1);
	
	if(printMaze)
		cout << g << endl;
	
	f1 >> teleportId;
	pathFound(teleportId, g);
	return 0;
}