Skip to content

Commit

Permalink
Added option to change install path
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardosouzag committed Jul 22, 2018
1 parent f2dc5b3 commit 913d734
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
2 changes: 0 additions & 2 deletions ModInstaller/ManualPathLocation.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions ModInstaller/ModManager.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 16 additions & 29 deletions ModInstaller/ModManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,15 @@ private void ResizeUI()
// Set button locations
button1.Size = new Size(groupBox1.Width, 23);
button2.Size = new Size(groupBox1.Width, 23);
button3.Size = new Size(groupBox1.Width, 23);
groupBox1.Top = 3;
groupBox1.Left = 3;
button1.Top = InstallList.Bottom + 9;
button1.Left = 3;
button2.Top = button1.Bottom;
button2.Left = 3;
button3.Top = button2.Bottom;
button3.Left = 3;
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
}
Expand Down Expand Up @@ -708,6 +711,19 @@ private void ManualInstallClick(object sender, EventArgs e)
openFileDialog.ShowDialog();
}

void ChangePathClick(object sender, EventArgs e)
{
folderBrowserDialog1.ShowDialog();
if (String.IsNullOrEmpty(folderBrowserDialog1.SelectedPath)) return;
Properties.Settings.Default.installFolder = folderBrowserDialog1.SelectedPath;
Properties.Settings.Default.APIFolder = $@"{Properties.Settings.Default.installFolder}/hollow_knight_Data/Managed";
Properties.Settings.Default.modFolder = $@"{Properties.Settings.Default.APIFolder}/Mods";
Properties.Settings.Default.Save();
if (!Directory.Exists(Properties.Settings.Default.modFolder)) Directory.CreateDirectory(Properties.Settings.Default.modFolder);
MessageBox.Show(text: $"Hollow Knight installation path:\n{Properties.Settings.Default.installFolder}");
Close();
}

private void DoManualInstall(object sender, System.EventArgs e)
{
if (openFileDialog.FileNames.Length >= 1)
Expand Down Expand Up @@ -780,35 +796,6 @@ private struct Mod
}
private List<Mod> modsList = new List<Mod>();

public enum Platform
{
Windows,
Linux,
Mac
}

public static Platform RunningPlatform()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.Unix:
// Well, there are chances MacOSX is reported as Unix instead of MacOSX.
// Instead of platform check, we'll do a feature checks (Mac specific root folders)
if (Directory.Exists("/Applications")
& Directory.Exists("/System")
& Directory.Exists("/Users")
& Directory.Exists("/Volumes"))
return Platform.Mac;
else
return Platform.Linux;

case PlatformID.MacOSX:
return Platform.Mac;

default:
return Platform.Windows;
}
}
private string apilink;
private string apiMD5;
public bool isOffline;
Expand Down

0 comments on commit 913d734

Please sign in to comment.