1
0
mirror of synced 2024-11-15 09:43:50 +00:00
PettingZoo/PettingZoo.Core/Settings/PettingZooPaths.cs
Mark van Renswoude 133adf205c WIP: generate examples from Tapeti message classes from NuGet feeds
- Implementation of assembly/nuget package selection UI
- Actual example generation needs more work
2021-12-31 18:48:04 +01:00

27 lines
887 B
C#

using System;
using System.IO;
using System.Reflection;
namespace PettingZoo.Core.Settings
{
public static class PettingZooPaths
{
public static string AppDataRoot { get; }
public static string InstallationRoot { get; }
static PettingZooPaths()
{
var appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
if (appDataPath == null)
throw new IOException("Could not resolve application data path");
AppDataRoot = Path.Combine(appDataPath, @"PettingZoo");
if (!Directory.CreateDirectory(AppDataRoot).Exists)
throw new IOException($"Failed to create directory: {AppDataRoot}");
InstallationRoot = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location ?? Assembly.GetExecutingAssembly().Location)!;
}
}
}