mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Add a folder checker to CheckValidInstallPath.
This commit is contained in:
parent
8fed7ec25f
commit
c3f34fedde
@ -113,6 +113,7 @@ namespace Wabbajack.Common
|
||||
public static int WabbajackCachePort = 80;
|
||||
public static int MaxHTTPRetries = 4;
|
||||
public static RelativePath MO2ModFolderName = (RelativePath)"mods";
|
||||
public static RelativePath MO2ProfilesFolderName = (RelativePath)"profiles";
|
||||
|
||||
public static AbsolutePath PatchCacheFolder => LocalAppDataPath.Combine("patch_cache");
|
||||
public static int MaxConnectionsPerServer = 4;
|
||||
|
@ -21,6 +21,7 @@ using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
||||
using File = Alphaleonis.Win32.Filesystem.File;
|
||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||
using SectionData = Wabbajack.Common.SectionData;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
@ -428,12 +429,22 @@ namespace Wabbajack.Lib
|
||||
return ErrorResponse.Fail($"Cannot install into a folder with a Wabbajack ModList inside of it");
|
||||
}
|
||||
|
||||
// Check folder is either empty, or a likely valid previous install
|
||||
// Check if folder is empty
|
||||
if (path.IsEmptyDirectory)
|
||||
{
|
||||
return ErrorResponse.Success;
|
||||
}
|
||||
|
||||
// Check if folders indicative of a previous install exist
|
||||
var checks = new List<RelativePath>() {
|
||||
Consts.MO2ModFolderName,
|
||||
Consts.MO2ProfilesFolderName
|
||||
};
|
||||
if (checks.All(c => path.Combine(c).Exists))
|
||||
{
|
||||
return ErrorResponse.Success;
|
||||
}
|
||||
|
||||
// If we have a MO2 install, assume good to go
|
||||
if (path.EnumerateFiles(false).Any(file =>
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user