made a prompt to create a new manifest.json if not using the default folder

This commit is contained in:
Carson McManus 2016-08-25 21:52:21 -04:00
parent 49bee022e9
commit 007588de38
2 changed files with 16 additions and 3 deletions

View file

@ -63,9 +63,22 @@ public class Manifest
if (!File.Exists(maFile)) if (!File.Exists(maFile))
{ {
if (Program.Verbose) Console.WriteLine("warn: No manifest file found at {0}", maFile); if (Program.Verbose) Console.WriteLine("warn: No manifest file found at {0}", maFile);
bool? createNewManifest = Program.SteamGuardPath ==
Program.defaultSteamGuardPath.Replace("~", Environment.GetEnvironmentVariable("HOME")) ? true : (bool?) null;
while (createNewManifest == null)
{
Console.Write($"Generate new manifest.json in {Program.SteamGuardPath}? [Y/n]");
var answer = Console.ReadLine();
if (answer != null)
createNewManifest = !answer.StartsWith("n") && !answer.StartsWith("N");
}
if ((bool) createNewManifest)
{
_manifest = _generateNewManifest(true); _manifest = _generateNewManifest(true);
return _manifest; return _manifest;
} }
return null;
}
try try
{ {

View file

@ -11,7 +11,7 @@ using System.Threading.Tasks;
public static class Program public static class Program
{ {
const string defaultSteamGuardPath = "~/maFiles"; public const string defaultSteamGuardPath = "~/maFiles";
public static string SteamGuardPath { get; set; } = defaultSteamGuardPath; public static string SteamGuardPath { get; set; } = defaultSteamGuardPath;
public static Manifest Manifest { get; set; } public static Manifest Manifest { get; set; }