public static void RefreshOptions()
 {
     _foundPathForSavedOptions = string.Empty;
     _savedOptions             = null;
     InitializeOptionsIfNeeded();
 }
        static void InitializeOptionsIfNeeded()
        {
            if (_savedOptions == null)
            {
                _foundPathForSavedOptions = string.Empty;
            }

            if (string.IsNullOrEmpty(_foundPathForSavedOptions))
            {
                // look for the file in this order:
                // 1. inside the BuildReport folder
                // 2. at the very topmost Assets folder
                // 3. outside the Assets folder
                // 4. in the ProjectSettings folder
                // 5. in the User's My Documents folder


                // ---------------------------------------------------
                // look in /Assets/BuildReport/
                var optionsInBuildReportFolder = DefaultOptionsPath;
                if (File.Exists(optionsInBuildReportFolder))
                {
                    _savedOptions             = BuildReportTool.SavedOptions.Load(optionsInBuildReportFolder);
                    _foundPathForSavedOptions = optionsInBuildReportFolder;
                    return;
                }

                // ---------------------------------------------------
                // look in /Assets/Plugins/BuildReport/
                var optionsInPluginsBuildReport = string.Format("{0}/Plugins/BuildReport/{1}", Application.dataPath, SAVED_OPTIONS_FILENAME);
                if (File.Exists(optionsInPluginsBuildReport))
                {
                    _savedOptions             = BuildReportTool.SavedOptions.Load(optionsInPluginsBuildReport);
                    _foundPathForSavedOptions = optionsInPluginsBuildReport;
                    return;
                }

                // ---------------------------------------------------
                // search for "BuildReport" folder and look in there
                if (!IsBuildReportInRegularPaths)
                {
                    string customBuildReportFolder = BuildReportTool.Util.FindAssetFolder(Application.dataPath, BUILD_REPORT_TOOL_DEFAULT_FOLDER_NAME);
                    if (!string.IsNullOrEmpty(customBuildReportFolder))
                    {
                        var optionsInCustomBuildReportFolder = string.Format("{0}/{1}", customBuildReportFolder, SAVED_OPTIONS_FILENAME);
                        if (File.Exists(optionsInCustomBuildReportFolder))
                        {
                            _savedOptions             = BuildReportTool.SavedOptions.Load(optionsInCustomBuildReportFolder);
                            _foundPathForSavedOptions = optionsInCustomBuildReportFolder;
                            return;
                        }
                    }
                }

                // ---------------------------------------------------
                // look in /Assets/
                var optionsInTopmostAssets = string.Format("{0}/{1}", Application.dataPath, SAVED_OPTIONS_FILENAME);
                if (File.Exists(optionsInTopmostAssets))
                {
                    _savedOptions             = BuildReportTool.SavedOptions.Load(optionsInTopmostAssets);
                    _foundPathForSavedOptions = optionsInTopmostAssets;
                    return;
                }

                // ---------------------------------------------------
                // look in Unity project folder (where Assets, Library, and ProjectSettings folder are)
                var outsideAssets        = BuildReportTool.Util.GetProjectPath(Application.dataPath);
                var optionsOutsideAssets = string.Format("{0}{1}", outsideAssets, SAVED_OPTIONS_FILENAME);
                if (File.Exists(optionsOutsideAssets))
                {
                    _savedOptions             = BuildReportTool.SavedOptions.Load(optionsOutsideAssets);
                    _foundPathForSavedOptions = optionsOutsideAssets;
                    return;
                }

                // ---------------------------------------------------
                // look inside ProjectSettings folder
                var optionsInProjectSettings = string.Format("{0}ProjectSettings/{1}", outsideAssets, SAVED_OPTIONS_FILENAME);
                //Debug.LogFormat("Looking in {0}", optionsInProjectSettings);
                if (File.Exists(optionsInProjectSettings))
                {
                    _savedOptions             = BuildReportTool.SavedOptions.Load(optionsInProjectSettings);
                    _foundPathForSavedOptions = optionsInProjectSettings;
                    return;
                }

                // ---------------------------------------------------
                // look in /My Documents/UnityBuildReports/
                var optionsInMyDocs = string.Format("{0}/{1}/{2}", BuildReportTool.Util.GetUserHomeFolder(), BUILD_REPORTS_DEFAULT_FOLDER_NAME, SAVED_OPTIONS_FILENAME);
                //Debug.LogFormat("Looking in {0}", optionsInMyDocs);
                if (File.Exists(optionsInMyDocs))
                {
                    _savedOptions             = BuildReportTool.SavedOptions.Load(optionsInMyDocs);
                    _foundPathForSavedOptions = optionsInMyDocs;
                    return;
                }

                // ---------------------------------------------------
            }

            // if the options file failed to load
            // one last try
            //
            if (_savedOptions == null)
            {
                if (!string.IsNullOrEmpty(_foundPathForSavedOptions) && File.Exists(_foundPathForSavedOptions))
                {
                    // there's a valid options file already
                    // just load that one
                    _savedOptions = BuildReportTool.SavedOptions.Load(_foundPathForSavedOptions);
                }
            }

            // could not load the file, or there isn't one yet (at least, not in any recognized valid paths).
            // so create a new one at the default path
            if (_savedOptions == null)
            {
                _savedOptions             = new BuildReportTool.SavedOptions();
                _foundPathForSavedOptions = DefaultOptionsPath;

                var defaultFolder = Path.GetDirectoryName(_foundPathForSavedOptions);
                if (!string.IsNullOrEmpty(defaultFolder) && !Directory.Exists(defaultFolder))
                {
                    Directory.CreateDirectory(defaultFolder);
                }

                SavedOptions.Save(_foundPathForSavedOptions, _savedOptions);
                Debug.LogFormat("Build Report Tool: Created a new options file at: {0}", _foundPathForSavedOptions);
            }
        }