PathToConfigFiles

2007-10-03
2013-04-22
  • DrPepper808
    DrPepper808
    2007-10-03

    Hi
    I have been trying to set the Path for the config dir.
    Is there a sample on how to do this?

     
    • DrPepper808
      DrPepper808
      2007-10-03

      This is what I was using

      AIMLbot.loadSettings("D:\test\config")

       
    • DrPepper,

      Could you post any error messages you're getting? Can't help otherwise... Also make sure the path is valid and that all the other config files are correctly referenced in the config file. One other thing, in your example you've called your bot instance the same as the namespace that the bot class is in. This *might* cause a problem if the compiler can't resolve what AIMLbot you mean (either the class or namespace)

       
    • DrPepper808
      DrPepper808
      2007-10-03

      Sure.
      this is the error I get:
      System.IO.FileNotFoundException was caught
        Message="Unable to find the specified file."
        Source="AIMLbot"
        StackTrace:
             at AIMLbot.Utils.SettingsDictionary.loadSettings(String pathToSettings)
             at AIMLbot.Bot.loadSettings(String pathToSettings)
             at GbotMain.AIMLbotAI.OpenDataFile() in D:..Strip...AIMLbotAI.vb:line 34

      the MyAIMLbot.PathToConfigFiles   always points to the default App Path.
      here is where it gets fun.  if I create a /config with a setting file in the default path it will pick up a alt with the loadSettings.  It seems that it need the Default before it can pick up a alt.

      Now I am not using a ALt.  I need to move the config dir out of the default application.  I am still testing to see what more I can find

       
  • Guy El
    Guy El
    2011-03-05

    did you find a solution to this?

     

  • Anonymous
    2012-07-23

    Just curious if anyone has managed to successfully use this with an ASP.net MVC project? I'm getting a similar error that it can't find the file during the loadSettings call. I've managed to verify though that it is correctly pointing to both config and setting.xml before the call.

    The chat class

        public class ChatBot : Bot
        {
            private Bot myBot;
            private User myUser;
            public ChatBot(string filepath)
            {
                myBot = new Bot();
                myUser = new User("Human", myBot);
                Initialize(filepath);
            }
            private void Initialize(string filepath)
            {
                myBot.loadSettings(filepath);
                myBot.isAcceptingUserInput = false;
                myBot.loadAIMLFromFiles();
                myBot.isAcceptingUserInput = true;
            }
            public String GetOutput(String input)
            {
                Request r = new Request(input, myUser, this);
                Result res = Chat(r);
                return (res.Output);
            }
        }
    

    From controller

                string filePath = System.IO.Path.Combine(Server.MapPath(""), System.IO.Path.Combine("config", "Settings.xml"));
                ChatBot catbot = new ChatBot(filePath);