title: C++ API object instantiation issues in Android Studio project (android.system.ErrnoException: open failed: ENOENT (No such file or directory))
body: <h1>Skip to EDIT1 for updated info</h1>
  
  <p>What I am trying to achieve:
  - I have two classes in my project, a Communicator which communicates with the third party API and the main class that I use to translate the info I receive from the communicator. </p>
  
  <ul>
  <li>My question is: What do I need to do to get my "ds.config" file, which I'm passing as a string, to get loaded? That is if that is even the problem here.</li>
  <li><p>Another Question is: How could I debug this to figure out what is going wrong? </p></li>
  <li><p>First step is I "initialize my communicator" in the Main.java file: </p>
  
  <pre><code>try{
      mDSC = Communicator.createDSCommunicator("ds.config", gRecordDevice, gPlaybackDevice);
  } catch (IOException e1) {
      // Failed
  }
  </code></pre></li>
  <li><p>Inside of Communicator this looks like:</p>
  
  <pre><code>public static Communicator createDSCommunicator(String dsConfigFile, String captureMixerName, String playerMixerName) throws IOException {
  DSRecognizer dsRecognizer = new DSRecognizer();
  
  dsRecognizer.setInitInfo(dsConfigFile);  //THIS LINE CAUSES PROBLEM
  
  // Only applies if setting a filter
  dsRecognizer.setLanguage(Language.ENGLISH);
  
  DLog.setLogger(new DLogInterface() {
      @Override
      public void w(String s, String s2) {
          System.out.println("DS log Warning  s:" + s + "  s2:" + s2);
      }
  
      @Override
      public void v(String s, String s2) {
          System.out.println("DS log Verbose  s:" + s + "  s2:" + s2);
      }
  
      @Override
      public void e(String s, String s2) {
          System.out.println("DS log Error  s:" + s + "  s2:" + s2);
      }
  
      @Override
      public void i(String s, String s2) {
          System.out.println("DS log Info  s:" + s + " s2:" + s2);
      }
  
      @Override
      public void d(String s, String s2) {
          System.out.println("DS log Debug  s:" + s + "  s2:" + s2);
      }
  });
  
  return new Communicator(dsRecognizer, captureMixerName, playerMixerName);
  }
  </code></pre></li>
  <li><p>Now is where it kinda gets out of my hands, dsRecognizer is a C++ file from the API. This is the code:</p>
  
  <pre><code>public void setInitInfo(String infoFile) throws FileNotFoundException, IOException {
  if(this.isInitialized()) {
      SLog.v("DSRecognizer", "setInitInfo returning; can only be called prior to init()");
  } else {
      SLog.v("DSRecognizer", "Info file " + infoFile);
      Properties p = new Properties();
      FileInputStream fin = null;
  
      try {
          fin = new FileInputStream(infoFile); //It doesn't get past this line
          p.load(fin);
      } finally {
          if(fin != null) {
              try {
                  fin.close();
              } catch (IOException var13) {
                  ;
              }
          }
  
      }
  
      File f = new File(infoFile);
      File parent = f.getParentFile();
      String path = ".";
      if(parent != null) {
          path = parent.getAbsolutePath();
      }
  
      SLog.v("DSRecognizer", "Setting base directory: " + path);
      this.mBaseDirectory = path;
      if(!p.containsKey("SamplingRate")) {
          p.setProperty("SamplingRate", Integer.toString(16000));
      }
  
      this.mSamplingRate = Integer.parseInt(p.getProperty("SamplingRate"));
      this.mUrlAudio = new URLAudio(this.mSamplingRate);
      if(p.containsKey("Parameters")) {
          this.mParameters = p.getProperty("Parameters");
      } else {
          if(!p.containsKey("parameters")) {
              throw new FileNotFoundException("parameters file not specified in info file");
          }
  
          this.mParameters = p.getProperty("parameters");
          p.remove("parameters");
          p.setProperty("Parameters", this.mParameters);
      }
  
      SLog.v("DSRecognizer", "parameters file set to: " + this.mParameters);
      this.mGrammar = null;
      if(p.containsKey("Grammar")) {
          this.mGrammar = p.getProperty("Grammar");
      } else if(p.containsKey("grammarentry")) {
          this.mGrammar = p.getProperty("grammarentry");
          p.remove("grammarentry");
          p.setProperty("Grammar", this.mGrammar);
      }
  
      SLog.v("DSRecognizer", "default grammar entry set to: " + this.mGrammar);
      if(!p.containsKey("RecognizerType")) {
          boolean rescore = false;
          if(p.containsKey("Rescore")) {
              rescore = Boolean.parseBoolean(p.getProperty("Rescore"));
          } else if(p.containsKey("rescore")) {
              rescore = Boolean.parseBoolean(p.getProperty("rescore"));
          }
  
          if(rescore) {
              p.setProperty("RecognizerType", "rescore");
          } else {
              p.setProperty("RecognizerType", "plain");
          }
      }
  
      p.remove("Rescore");
      p.remove("rescore");
      this.mRecognizerType = p.getProperty("RecognizerType");
      SLog.v("DSRecognizer", "recognizer type (plain|rescore|dnn) set to: " + this.mRecognizerType);
      this.mEpParameters = "";
      if(p.containsKey("EPParameters")) {
          this.mEpParameters = p.getProperty("EPParameters");
      } else if(p.containsKey("epparameters")) {
          this.mEpParameters = p.getProperty("epparameters", "");
          p.remove("epparameters");
          p.setProperty("EPParameters", this.mEpParameters);
      }
  
      this.mEpGrammar = "";
      if(p.containsKey("EPGrammar")) {
          this.mEpGrammar = p.getProperty("EPGrammar");
      } else if(p.containsKey("epgrammarentry")) {
          this.mEpGrammar = p.getProperty("epgrammarentry", "");
          p.remove("epgrammarentry");
          p.setProperty("EPGrammar", this.mEpGrammar);
      }
  
      StringBuffer sb = new StringBuffer();
      Enumeration en = p.keys();
  
      while(en.hasMoreElements()) {
          String key = (String)en.nextElement();
          sb.append(key);
          sb.append(" ");
          sb.append(p.getProperty(key));
          sb.append("\n");
      }
  
      this.mInitString = sb.toString();
      SLog.v("DSRecognizer", "DS initialization config: " + this.mInitString);
  }
  }    
  </code></pre></li>
  <li><p>Somewhere my "ds.config" file, which is in the assets folder of my android studio project, is not being recognized.</p></li>
  <li><p>Communicator.createDSCommunicator exits after the line marked with the comment "This line causes problem"</p></li>
  <li>I tried loading the file the same way it's done in dsRecognizer in my main java file, tried loading it using just plain File a = new File().</li>
  <li>My question is: What do I need to do to get my "ds.config" file, which I'm passing as a string, to get loaded? That is if that is even the problem here.</li>
  <li>Another Question is: How could I debug this to figure out what is going wrong?</li>
  </ul>
  
  <h1>EDIT1</h1>
  
  <p>Figured out what the problem is: My "ds.config" file is not being located and is giving the error "android.system.ErrnoException: open failed: ENOENT (No such file or directory)".</p>
  
  <ul>
  <li><p>The file "ds.config" is located in the assets folder of my Android Studio project and any path I provide as a string input to my initializeDS() method causes this error. I need to pass a string to the API file to load the config file but what string do I pass?</p></li>
  <li><p>Also interested in finding out if there is any other way I can acheive this?</p></li>
  </ul>