changeset 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 9a1f83057e84
children f3afde2a8ced
files chromamethods.cpp
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/chromamethods.cpp	Tue Oct 26 13:01:54 2010 +0900
+++ b/chromamethods.cpp	Tue Oct 26 17:45:33 2010 +0900
@@ -287,13 +287,19 @@
 
     vector<string> ppath = getPluginPath();
     for (int i = 0; i < ppath.size(); ++i) {
-	chordDictFilename = ppath[i] + "/" + chordDictBase;
-	cerr << "Looking for chord.dict in " << chordDictFilename << "..." << endl;
-	if (iostreams::stream<iostreams::file_source>(chordDictFilename.c_str())
-	    .is_open()) {
-	    cerr << "(Success)" << endl;
-	    break;
-	}
+    	chordDictFilename = ppath[i] + "/" + chordDictBase;
+    	cerr << "Looking for chord.dict in " << chordDictFilename << "..." ;
+    	fstream fin;
+        fin.open(chordDictFilename.c_str(),ios::in);
+        if( fin.is_open() )
+        {
+            fin.close();
+    	    cerr << " success." << endl;
+    	    break;
+        } else {
+            if (i < ppath.size()-1) cerr << " (not found yet) ..." << endl;
+            else cerr << "* ERROR: failed to find chord dictionary." << endl;
+        }
     }
 
     iostreams::stream<iostreams::file_source> chordDictFile(chordDictFilename);