コード例 #1
0
ファイル: Preferences.cs プロジェクト: hanahanaside/JPN
        public static void Refresh()
        {
            _preferencesContainer = !GlobalSettings ? LoadPreferencesContainer() : new PreferencesContainer();

            // Dumb but effective way to initialize values
            _preferencesContainer.AutoCompress = AutoCompress;
            _preferencesContainer.CompressionAlgorithm = CompressionAlgorithm;
            _preferencesContainer.CompressionQualityLz4 = CompressionQualityLz4;
            _preferencesContainer.LocalCacheVersion = LocalCacheVersion;
            _preferencesContainer.EnableLogFile = EnableLogFile;
            _preferencesContainer.EnableHardLinks = EnableHardLinks;
            _preferencesContainer.DefaultStandaloneBuildTargetOption = DefaultStandaloneBuildTargetOption;
            _preferencesContainer.DefaultWebPlayerBuildTargetOption = DefaultWebPlayerBuildTargetOption;

			// Prevent hard links being enabled while the cache path is pointing to another volume
			if (Application.platform == RuntimePlatform.OSXEditor && _preferencesContainer.EnableHardLinks == true && _preferencesContainer.CachePath != null && _preferencesContainer.CachePath.StartsWith("/Volumes/")) {
				CachePath = null;
			}

			// Check cache path exists or can be created, otherwise reset
			if (_preferencesContainer.CachePath != null)
			{
				try
				{
                    if (!Directory.Exists(_preferencesContainer.CachePath)) {
					    Directory.CreateDirectory(_preferencesContainer.CachePath);
                    }
				}
				catch
				{
                    _preferencesContainer.CachePath = null;
                    SavePreferences();
				}
			}
        }
コード例 #2
0
ファイル: Preferences.cs プロジェクト: jiradejcu/Experiment
        public static void Refresh()
        {
            _preferencesContainer = !GlobalSettings?LoadPreferencesContainer() : new PreferencesContainer();

            // Dumb but effective way to initialize values
            _preferencesContainer.AutoCompress          = AutoCompress;
            _preferencesContainer.CompressionAlgorithm  = CompressionAlgorithm;
            _preferencesContainer.CompressionQualityLz4 = CompressionQualityLz4;
            _preferencesContainer.LocalCacheVersion     = LocalCacheVersion;
            _preferencesContainer.EnableLogFile         = EnableLogFile;
            _preferencesContainer.EnableHardLinks       = EnableHardLinks;
            _preferencesContainer.DefaultStandaloneBuildTargetOption = DefaultStandaloneBuildTargetOption;
            _preferencesContainer.DefaultWebPlayerBuildTargetOption  = DefaultWebPlayerBuildTargetOption;

            // Prevent hard links being enabled while the cache path is pointing to another volume
            if (Application.platform == RuntimePlatform.OSXEditor && _preferencesContainer.EnableHardLinks == true && _preferencesContainer.CachePath != null && _preferencesContainer.CachePath.StartsWith("/Volumes/"))
            {
                CachePath = null;
            }

            // Check cache path exists or can be created, otherwise reset
            if (_preferencesContainer.CachePath != null)
            {
                try
                {
                    if (!Directory.Exists(_preferencesContainer.CachePath))
                    {
                        Directory.CreateDirectory(_preferencesContainer.CachePath);
                    }
                }
                catch
                {
                    _preferencesContainer.CachePath = null;
                    SavePreferences();
                }
            }
        }