Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Renamed disabled mods directory per Natti's request.

  • Loading branch information...
commit 62962adeab77c0211339e139ae17c097d6c1ee99 1 parent 3fae97c
Andy Brenneke authored March 19, 2011
2  CortexCommandModManager/Constants.cs
@@ -2,7 +2,7 @@
2 2
 {
3 3
     static class Constants
4 4
     {
5  
-        public const string DisabledModPath = "Disabled_Mods";
  5
+        
6 6
         private static readonly string[] originalInstallationMods = new[] {"Base.rte","Browncoats.rte","Coalition.rte","Dummy.rte",
7 7
                                               "Missions.rte","Ronin.rte","Tutorial.rte","Undead.rte",
8 8
                                               "Whitebots.rte","Wildlife.rte"};
21  CortexCommandModManager/ModManager.cs
@@ -6,17 +6,32 @@ namespace CortexCommandModManager
6 6
 {
7 7
     public static class ModManager
8 8
     {
  9
+        public const string OldDisabledModPath = "Disabled_Mods";
  10
+        public const string DisabledModPath = "_disabled_mods";
  11
+
9 12
         /// <summary>
10 13
         /// Checks if the disabled mods folder exists and creates it if it doesn't.
11 14
         /// </summary>
12 15
         [Obsolete("Shouldn't be static")]
13 16
         public static void CheckDisabledFolderExists()
14 17
         {
15  
-            if (!Directory.Exists(Grabber.Settings.Get().CCInstallDirectory + "\\" + Constants.DisabledModPath))
  18
+            if (!Directory.Exists(Grabber.Settings.Get().CCInstallDirectory + "\\" + DisabledModPath))
  19
+            {
  20
+                Directory.CreateDirectory(Grabber.Settings.Get().CCInstallDirectory + "\\" + DisabledModPath);
  21
+            }
  22
+        }
  23
+
  24
+        public static void RenameDisabledFolderIfNeeded()
  25
+        {
  26
+            var fullOldDirectory = Path.Combine(Grabber.Settings.Get().CCInstallDirectory, OldDisabledModPath);
  27
+            var fullNewDirectory = Path.Combine(Grabber.Settings.Get().CCInstallDirectory, DisabledModPath);
  28
+
  29
+            if (Directory.Exists(fullOldDirectory))
16 30
             {
17  
-                Directory.CreateDirectory(Grabber.Settings.Get().CCInstallDirectory + "\\" + Constants.DisabledModPath);
  31
+                Directory.Move(fullOldDirectory, fullNewDirectory);
18 32
             }
19 33
         }
  34
+
20 35
         /// <summary>
21 36
         /// Enables a mod and returns the new location of the mod
22 37
         /// </summary>
@@ -44,7 +59,7 @@ public static string DisableMod(Mod mod)
44 59
             string myDirectory = modCurrentFolder.Name;
45 60
 
46 61
             string source = mod.FullFolderPath;
47  
-            string destination = Grabber.Settings.Get().CCInstallDirectory + "\\" + Constants.DisabledModPath + "\\" + myDirectory;
  62
+            string destination = Grabber.Settings.Get().CCInstallDirectory + "\\" + DisabledModPath + "\\" + myDirectory;
48 63
 
49 64
             MoveMod(source, destination);
50 65
             InvalidateCache();
6  CortexCommandModManager/ModScanner.cs
@@ -28,7 +28,7 @@ public List<Mod> GetEnabledMods()
28 28
         public List<Mod> GetDisabledMods()
29 29
         {
30 30
             string mainGameFolder = Grabber.Settings.Get().CCInstallDirectory;
31  
-            List<Mod> modList = GetDirectMods(mainGameFolder + "\\" + Constants.DisabledModPath);
  31
+            List<Mod> modList = GetDirectMods(mainGameFolder + "\\" + ModManager.DisabledModPath);
32 32
             Mods = modList;
33 33
             return modList;
34 34
         }
@@ -41,7 +41,7 @@ private static List<Mod> GetDirectMods(string folder)
41 41
         private static Mod MakeModFromDirectory(string directory, string rootFolder)
42 42
         {
43 43
             string modPath = directory;
44  
-            bool enabled = !(rootFolder.Contains(Constants.DisabledModPath));
  44
+            bool enabled = !(rootFolder.Contains(ModManager.DisabledModPath));
45 45
             string modDirectory = MakeModNameFromDirectory(directory);
46 46
             string name = TryGetModName(modPath) ?? MakeModNameFromDirectory(directory);
47 47
             string image = FindModImagePath(modPath);
@@ -81,7 +81,7 @@ public static Mod SearchForMod(string modDirectoryName)
81 81
             }
82 82
             if (!found)
83 83
             {
84  
-                string[] disabledDirectories = Directory.GetDirectories(Grabber.Settings.Get().CCInstallDirectory + "\\" + Constants.DisabledModPath);
  84
+                string[] disabledDirectories = Directory.GetDirectories(Grabber.Settings.Get().CCInstallDirectory + "\\" + ModManager.DisabledModPath);
85 85
                 foreach (string directory in disabledDirectories)
86 86
                 {
87 87
                     if (directory.Contains(modDirectoryName))
1  CortexCommandModManager/Startup/CortexCommandInitializer.cs
@@ -16,6 +16,7 @@ public CortexCommandInitializer(CCMMInitialization initialization)
16 16
 
17 17
         public void Initialize()
18 18
         {
  19
+            ModManager.RenameDisabledFolderIfNeeded();
19 20
             ModManager.CheckDisabledFolderExists();
20 21
             InitEnhancedSkirmish();
21 22
         }

0 notes on commit 62962ad

Please sign in to comment.
Something went wrong with that request. Please try again.