I need to add some set paths

2008-02-04
2013-04-22
  • DrPepper808
    DrPepper808
    2008-02-04

    The Current release uses “Environment.CurrentDirectory” but the application I use changes the original “Environment.CurrentDirectory” to another locataion.  I need to find a way to set the PathToAIML and the PathToConfigFiles back to the true location.  
    I am not that great with C, how can I make the change.  
    Do I make a
            public string PathToAIML
            {
                Put
                {
                    Not Sure What Goes Here???;
                }
            }

     
    • Hi DrPepper,

      Take a look at the Bot class. From around line 337 you'll notice the methods used to load the config files into the bot are all overridden so you can specify either the path to the file or use an XmlDocument object that you've loaded yourself. Rather than let the bot set itself up with the defaults you'll have to code these steps yourself.

      Let me know how you get on...

      Nicholas.

       
    • Actually,

      Another strategy would be to change the code in the Bot class so you have something like this (remembering to do this also for the other "PathTo" attributes:

                         // to hold the path to the AIML files
                         private string pathtoaiml = string.Empty;

        258         /// <summary>
        259         /// The directory to look in for the AIML files
        260         /// </summary>
        261         public string PathToAIML
        262         {
        263             get
        264             {
                                if(this.pathtoaiml.Length==0)
                                {
                                       this.pathtoaiml = Path.Combine(Environment.CurrentDirectory, this.GlobalSettings.grabSetting("aimldirectory"));
                                }
                                return this.pathtoaiml;
        266             }
                            set
                            {
                                   this.pathtoaiml = value;
                            }
        267         }

       
    • DrPepper808
      DrPepper808
      2008-02-15

      That worked great.   Thanks