mirror of
https://github.com/Metabolix/HackBGRT.git
synced 2025-12-06 17:15:42 -08:00
Check for missing mountvol /S
This commit is contained in:
19
src/Esp.cs
19
src/Esp.cs
@@ -19,6 +19,19 @@ public sealed class Esp {
|
||||
}
|
||||
}
|
||||
|
||||
/** Output of mountvol. */
|
||||
private static string MountvolOutput;
|
||||
|
||||
/** Does MountvolOutput contain /S? */
|
||||
public static bool MountvolESPNotSupported {
|
||||
get {
|
||||
if (MountvolOutput == null) {
|
||||
MountvolOutput = Setup.Execute("mountvol", "", false);
|
||||
}
|
||||
return MountvolOutput.Contains(" /S") == false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor: do nothing.
|
||||
*/
|
||||
@@ -74,8 +87,9 @@ public sealed class Esp {
|
||||
Setup.Log("Esp.Find()");
|
||||
try {
|
||||
// Match "The EFI System Partition is mounted at E:\" with some language support.
|
||||
MountvolOutput = Setup.Execute("mountvol", "", false);
|
||||
var re = new Regex(" EFI[^\n]*(?:\n[ \t]*)?([A-Z]:\\\\)");
|
||||
var m = re.Match(Setup.Execute("mountvol", "", false));
|
||||
var m = re.Match(MountvolOutput);
|
||||
if (m.Success && TryPath(m.Groups[1].Captures[0].Value)) {
|
||||
return true;
|
||||
}
|
||||
@@ -102,6 +116,9 @@ public sealed class Esp {
|
||||
if (MountInstance != null) {
|
||||
return true;
|
||||
}
|
||||
if (MountvolESPNotSupported) {
|
||||
return false;
|
||||
}
|
||||
for (char c = 'A'; c <= 'Z'; ++c) {
|
||||
Setup.Log($"Esp.Mount: {c}");
|
||||
if (Setup.Execute("mountvol", c + ": /S", true) != null) {
|
||||
|
||||
@@ -300,6 +300,9 @@ public class Setup {
|
||||
}
|
||||
if (Esp.Location == null && !Esp.Find() && !Esp.Mount() && !Batch) {
|
||||
WriteLine("EFI System Partition was not found.");
|
||||
if (Esp.MountvolESPNotSupported) {
|
||||
WriteLine("Your computer doesn't support mountvol /S. You have to mount ESP manually.");
|
||||
}
|
||||
WriteLine("Press enter to exit, or give ESP path here: ");
|
||||
string s = Console.ReadLine();
|
||||
Log($"User input: {s}");
|
||||
|
||||
Reference in New Issue
Block a user