coenm / RepoM

👨‍💻 A minimal-conf git repository hub for Windows . This project is a fork of RepoZ
MIT License
6 stars 1 forks source link

RepoM crashes when specific config files are missing #92

Closed coenm closed 3 months ago

coenm commented 3 months ago

When starting RepoM (for instance, at the first time after installation), it requires some files to be present at %appdata%\Roaming\RepoM. When these do not exist, RepoM crashes

coenm commented 3 months ago
var filename = Path.Combine(basePath, FILENAME);
 if (_fileSystem.File.Exists(filename))
 {
     return filename;
 }

 var filenameTemplate = Path.Combine(_appDataPathProvider.AppResourcesPath, FILENAME);
 if (_fileSystem.File.Exists(filenameTemplate))
 {
     try
     {
         _fileSystem.File.Copy(filenameTemplate, filename);
     }
     catch (Exception e)
     {
         _logger.LogError(e, "Could not copy default {FILENAME} to {AppDataPath}", FILENAME, _appDataPathProvider.AppDataPath);
     }

     if (_fileSystem.File.Exists(filename))
     {
         return filename;
     }
 }

 throw new ConfigurationFileNotFoundException(filename);