mirror of
https://github.com/Tribufu/ServerManagers
synced 2026-08-09 04:31:06 +00:00
Added additional validation when setting directories in the global setting, to ensure they are rooted correctly.
This commit is contained in:
parent
7d6859915d
commit
6a46155463
8 changed files with 200 additions and 20 deletions
|
|
@ -48,7 +48,45 @@ namespace ServerManagerTool
|
|||
public App()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Config.Default.ServerManagerUniqueKey))
|
||||
{
|
||||
Config.Default.ServerManagerUniqueKey = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.DataPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.DataPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.DataPath = Config.Default.DataPath.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.ConfigPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.ConfigPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.ConfigPath = Config.Default.ConfigPath.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.BackupPath))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.BackupPath);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.BackupPath = Config.Default.BackupPath.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.AutoUpdate_CacheDir))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.AutoUpdate_CacheDir);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.AutoUpdate_CacheDir = Config.Default.AutoUpdate_CacheDir.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
App.Instance = this;
|
||||
ApplicationStarted = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue