Example #1
0
        public void ReadInit()
        {
            // if specified on the command line init_file_ is filled in
            // global_scope_t::handle_debug_options.  If it was specified on the command line
            // fail if the file doesn't exist. If no init file was specified
            // on the command-line then try the default values, but don't fail if there
            // isn't one.
            string initFile;

            if (InitFileHandler.Handled)
            {
                initFile = InitFileHandler.Str();
                if (!FileSystem.FileExists(initFile))
                {
                    throw new ParseError(String.Format(ParseError.ParseError_CouldNotFindSpecifiedInitFile, initFile));
                }
            }
            else
            {
                initFile = FileSystem.HomePath(".ledgerrc");
                if (!FileSystem.FileExists(initFile))
                {
                    initFile = ".ledgerrc";
                }
            }
            if (FileSystem.FileExists(initFile))
            {
                ParseInit(initFile);
            }
        }