int createDefaultConfig() { /* * Create GBA folder for configuration and ROMS */ if (false == check_mkdir("/accounts/1000/shared/misc/roms",0777) ) return -1; if (false == check_mkdir("/accounts/1000/shared/misc/gbaemu", 0777) ) return -1; if (false == check_mkdir("/accounts/1000/shared/misc/gbaemu/savegames", 0777) ) return -1; if (false == check_mkdir("/accounts/1000/shared/misc/roms/gba",0777) ) return -1; /* * If config file is not is misc/gbaemu, copy the default one */ ifstream ifile2("/accounts/1000/shared/misc/gbaemu/gpsp.cfg"); if(!ifile2){ ifstream f11("app/native/gpsp.cfg", fstream::binary); ofstream f22("/accounts/1000/shared/misc/gbaemu/gpsp.cfg", fstream::trunc|fstream::binary); f22 << f11.rdbuf(); f11.close(); f22.close(); } else { ifile2.close(); } /* * Copy game_config.txt to savegames folder if not there */ ifstream ifile3("/accounts/1000/shared/misc/gbaemu/savegames/game_config.txt"); if(!ifile3){ ifstream f11("app/native/game_config.txt", fstream::binary); ofstream f22("/accounts/1000/shared/misc/gbaemu/savegames/game_config.txt", fstream::trunc|fstream::binary); f22 << f11.rdbuf(); f11.close(); f22.close(); } else { ifile3.close(); } return 0; }
int CmdPull::execute (std::string& output) { context.footnote ("The 'pull' command is deprecated, and will be removed in a subsequent release."); std::vector <std::string> words = context.a3.extract_words (); std::string file; if (words.size ()) file = words[0]; Uri uri (file, "pull"); uri.parse (); if (uri._data.length ()) { Directory location (context.config.get ("data.location")); if (! uri.append ("{pending,undo,completed}.data")) throw format (STRING_CMD_PULL_NOT_DIR, uri._path); Transport* transport; if ((transport = Transport::getTransport (uri)) != NULL) { transport->recv (location._data + "/"); delete transport; } else { // Verify that files are not being copied from rc.data.location to the // same place. if (Directory (uri._path) == Directory (context.config.get ("data.location"))) throw std::string (STRING_CMD_PULL_SAME); // copy files locally // remove {pending,undo,completed}.data uri._path = uri.parent(); Path path1 (uri._path + "undo.data"); Path path2 (uri._path + "pending.data"); Path path3 (uri._path + "completed.data"); if (path1.exists() && path2.exists() && path3.exists()) { // if (confirm ("xxxxxxxxxxxxx")) // { std::ofstream ofile1 ((location._data + "/undo.data").c_str(), std::ios_base::binary); std::ifstream ifile1 (path1._data.c_str() , std::ios_base::binary); ofile1 << ifile1.rdbuf(); std::ofstream ofile2 ((location._data + "/pending.data").c_str(), std::ios_base::binary); std::ifstream ifile2 (path2._data.c_str() , std::ios_base::binary); ofile2 << ifile2.rdbuf(); std::ofstream ofile3 ((location._data + "/completed.data").c_str(), std::ios_base::binary); std::ifstream ifile3 (path3._data.c_str() , std::ios_base::binary); ofile3 << ifile3.rdbuf(); // } } else { throw format (STRING_CMD_PULL_MISSING, uri._path); } } output += format (STRING_CMD_PULL_TRANSFERRED, uri.ToString ()) + "\n"; } else throw std::string (STRING_CMD_PULL_NO_URI); return 0; }
int main(int argc, char* argv[]) { string cfgfile; char* file1; char* file2; char* resultfile; //check inputs if (argc < 4) { cout << "VIDEO ALIGNMENT\n"; cout << "--------------------------------------------------\n"; cout << "Syntax: align <video1> <video2> <result> [config]\n"; cout << "\n"; cout << "Example 1: align.exe video1.avi video2.avi result.txt\n"; cout << "\n"; cout << "Example 2: align.exe video1.avi video2.avi result.txt myconfig.ini\n"; cout << "\n"; cout << "--------------------------------------------------\n"; cout << "TCL Research America\n"; cout << "Armin Kappeler\n"; cout << "08//29//2013\n"; cin.get(); exit(0); } else { // if we got enough parameters... file1 = argv[1]; file2 = argv[2]; resultfile = argv[3]; if (argc >=5) { cfgfile = argv[4]; }else { cfgfile = "config.ini"; } ofstream ofile(resultfile); if (!ofile) { cout << "Invalid input argument 3: invalid output filename\n"; exit(0); } ofile.close(); ifstream ifile1(file1); if (!ifile1) { cout << "Invalid input argument 1: First video doesn't exist\n"; exit(0); } ifile1.close(); ifstream ifile2(file2); if (!ifile2) { cout << "Invalid input argument 2: Second video doesn't exist\n"; exit(0); } ifile2.close(); ifstream ifile3(cfgfile); if (!ifile3) { cout << "No configuration file found (Default filename: \"config.ini\")\n"; exit(0); } ifile3.close(); } //load configuration cout << "READ CONFIGURATION FILE\n"; ConfigFile cfg(cfgfile); SequentialAlignment sa; loadConfiguration(cfg,sa); //call Video Alignment cout << "VIDEO SEQUENCE ALIGNMENT\n"; sa.alignVideos(file1, file2, resultfile); return 0; }