mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Abort startup if config directory could not be found
We do not require any config files, but config directory - yes, we won't bother creating it manually as it heavily suggests user mistake, such as --path to the wrong directory.
This commit is contained in:
@@ -405,7 +405,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
private static void InitEvents() {
|
||||
if ((FileSystemWatcher != null) || (LastWriteEvents != null) || !Directory.Exists(SharedInfo.ConfigDirectory)) {
|
||||
if ((FileSystemWatcher != null) || (LastWriteEvents != null)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ namespace ArchiSteamFarm {
|
||||
HashSet<string> botNames;
|
||||
|
||||
try {
|
||||
botNames = Directory.Exists(SharedInfo.ConfigDirectory) ? Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*" + SharedInfo.JsonConfigExtension).Select(Path.GetFileNameWithoutExtension).Where(botName => !string.IsNullOrEmpty(botName) && IsValidBotName(botName)).ToHashSet(Bot.BotsComparer)! : new HashSet<string>(0);
|
||||
botNames = Directory.EnumerateFiles(SharedInfo.ConfigDirectory, "*" + SharedInfo.JsonConfigExtension).Select(Path.GetFileNameWithoutExtension).Where(botName => !string.IsNullOrEmpty(botName) && IsValidBotName(botName)).ToHashSet(Bot.BotsComparer)!;
|
||||
} catch (Exception e) {
|
||||
ArchiLogger.LogGenericException(e);
|
||||
|
||||
|
||||
9
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
9
ArchiSteamFarm/Localization/Strings.Designer.cs
generated
@@ -845,6 +845,15 @@ namespace ArchiSteamFarm.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Config directory could not be found, aborting!.
|
||||
/// </summary>
|
||||
public static string ErrorConfigDirectoryNotFound {
|
||||
get {
|
||||
return ResourceManager.GetString("ErrorConfigDirectoryNotFound", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Configured {0} property is invalid: {1}.
|
||||
/// </summary>
|
||||
|
||||
@@ -742,4 +742,7 @@ Process uptime: {1}</value>
|
||||
<data name="WarningUnknownCommandLineArgument" xml:space="preserve">
|
||||
<value>Unknown command-line argument: {0}</value>
|
||||
</data>
|
||||
<data name="ErrorConfigDirectoryNotFound" xml:space="preserve">
|
||||
<value>Config directory could not be found, aborting!</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace ArchiSteamFarm {
|
||||
|
||||
if (!uniqueInstance) {
|
||||
ASF.ArchiLogger.LogGenericError(Strings.ErrorSingleInstanceRequired);
|
||||
await Task.Delay(5000).ConfigureAwait(false);
|
||||
await Task.Delay(10000).ConfigureAwait(false);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -195,6 +195,13 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
if (!Directory.Exists(SharedInfo.ConfigDirectory)) {
|
||||
ASF.ArchiLogger.LogGenericError(Strings.ErrorConfigDirectoryNotFound);
|
||||
await Task.Delay(10000).ConfigureAwait(false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user