WIP: Road to v1.0.0 #6

Draft
ProfessionalUwU wants to merge 5 commits from fix/Pacserver into dev
2 changed files with 13 additions and 14 deletions
Showing only changes of commit 42fe907ec8 - Show all commits

View File

@ -4,7 +4,7 @@ namespace Pacserver.Tests;
public class TranserFilesTest {
[Fact]
public void transferPacmanCache_doesNotFail() {
public async void transferPacmanCache_doesNotFail() {
// Arrange
PacserverUtils utils = new PacserverUtils();

View File

@ -33,23 +33,22 @@ public partial class PacserverUtils {
string? line;
while ((line = file.ReadLine()) is not null) {
foreach (string path in pathsToDetermine.Where(path => line.Contains(path))) {
string cachePath = pathsToDetermine[0];
string dbPath = pathsToDetermine[1];
if (line.Contains(cachePath) || line.Contains(dbPath)) {
Match match = CacheDirOrDBPathRegex().Match(line);
if (match.Success) {
switch (path) {
case "CacheDir":
pacmanCacheDirectory = match.ToString();
break;
case "DBPath":
pacmanDatabaseDirectory = match.ToString();
break;
default:
throw new ArgumentException("Could not deal with " + match.ToString());
}
} else {
if(!match.Success) {
string pathsToDetermineString = string.Join(",", pathsToDetermine);
throw new DirectoryNotFoundException("Could not determine the necessary file paths: " + pathsToDetermineString);
}
if (line.Contains(cachePath)) {
pacmanCacheDirectory = match.ToString();
} else if (line.Contains(dbPath)) {
pacmanDatabaseDirectory = match.ToString();
}
}
}
}