[ISSUE] Directories don't pass validation if quoted in config
shinnova opened this issue · 2 comments
shinnova commented
Describe the bug
When directory paths in the config file are quoted, they don't pass the directory validation check.
To Reproduce
Steps to reproduce the behavior:
- Set GameDirectory="/path/to/directory" and run the problemchecker
- Get ERROR: Invalid game directory
Expected behavior
Problem checker continues as normal
This is easily fixable by checking for quotation marks in the config file
fosspill commented
Test code:
using System;
using System.Globalization;
using System.IO;
using Salaros.Configuration;
namespace ffmttest
{
class Program
{
static void Main(string[] args)
{
//Mimic config-file with Quotes
var configWithQuote = new ConfigParser(@"
[Directories]
GameDirectory = ""/home/btdk/Games/final-fantasy-xiv-a-realm-reborn/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn""
"
);
//Mimic config-file without Quotes
var configWithoutQuote = new ConfigParser(@"
[Directories]
GameDirectory = /home/btdk/Games/final-fantasy-xiv-a-realm-reborn/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn
"
);
var gamedirstr1 = configWithQuote.GetValue("Directories", "GameDirectory");
Console.WriteLine("With Quote in Config:" + gamedirstr1);
var gamedirstr2 = configWithoutQuote.GetValue("Directories", "GameDirectory");
Console.WriteLine("Without Quote in Config:" + gamedirstr2);
var gamedirstr3 = configWithoutQuote.GetValue("Directories", "GameDirectory");
Console.WriteLine("Workaround for Quoted:" + gamedirstr1.Trim('"'));
}
}
}
Output:
With Quote in Config:"/home/btdk/Games/final-fantasy-xiv-a-realm-reborn/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn"
Without Quote in Config:/home/btdk/Games/final-fantasy-xiv-a-realm-reborn/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn
Workaround for Quoted:/home/btdk/Games/final-fantasy-xiv-a-realm-reborn/drive_c/Program Files (x86)/SquareEnix/FINAL FANTASY XIV - A Realm Reborn
This seems like a config library bug we'll have to wok around.
fosspill commented
Fix in Default