public void ShouldBuildStringCorrectly(GameFolder folder, string expectedEndPart) { var localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var expectedResult = Path.Combine(localAppDataPath, expectedEndPart); var result = GamePaths.GetModFolderPath(folder); result.Should().Be(expectedResult); }
public ConfigStore( string modFolderName, string configFileName = DefaultConfigFileName, IXmlFileSystem <ModConfiguration> fileSystemWrapper = null) { this.fileSystemWrapper = fileSystemWrapper ?? new XmlFileSystem <ModConfiguration>(new FileSystemWrapper()); var modFolderPath = GamePaths.GetModFolderPath(GameFolder.Configs); modFolderPath = Path.Combine(modFolderPath, modFolderName); this.fileSystemWrapper.CreateDirectory(modFolderPath); ConfigFileInfo = new FileInfo(Path.Combine(modFolderPath, configFileName)); if (!this.fileSystemWrapper.FileExists(ConfigFileInfo)) { SaveConfigToFile(new ModConfiguration()); } cachedConfigs = LoadConfigFromFile(); }