comparison chromamethods.cpp @ 61:08d24cc21312 matthiasm-plugin

debugged the chord.dict finding
author Matthias Mauch <mail@matthiasmauch.net>
date Tue, 26 Oct 2010 17:45:33 +0900
parents 6e76c7710fa1
children b80144039d8f
comparison
equal deleted inserted replaced
60:9a1f83057e84 61:08d24cc21312
285 string chordDictBase("chord.dict"); 285 string chordDictBase("chord.dict");
286 string chordDictFilename; 286 string chordDictFilename;
287 287
288 vector<string> ppath = getPluginPath(); 288 vector<string> ppath = getPluginPath();
289 for (int i = 0; i < ppath.size(); ++i) { 289 for (int i = 0; i < ppath.size(); ++i) {
290 chordDictFilename = ppath[i] + "/" + chordDictBase; 290 chordDictFilename = ppath[i] + "/" + chordDictBase;
291 cerr << "Looking for chord.dict in " << chordDictFilename << "..." << endl; 291 cerr << "Looking for chord.dict in " << chordDictFilename << "..." ;
292 if (iostreams::stream<iostreams::file_source>(chordDictFilename.c_str()) 292 fstream fin;
293 .is_open()) { 293 fin.open(chordDictFilename.c_str(),ios::in);
294 cerr << "(Success)" << endl; 294 if( fin.is_open() )
295 break; 295 {
296 } 296 fin.close();
297 cerr << " success." << endl;
298 break;
299 } else {
300 if (i < ppath.size()-1) cerr << " (not found yet) ..." << endl;
301 else cerr << "* ERROR: failed to find chord dictionary." << endl;
302 }
297 } 303 }
298 304
299 iostreams::stream<iostreams::file_source> chordDictFile(chordDictFilename); 305 iostreams::stream<iostreams::file_source> chordDictFile(chordDictFilename);
300 string line; 306 string line;
301 int iElement = 0; 307 int iElement = 0;