mirror of
https://github.com/tribufu/ServerManagers
synced 2026-06-01 09:42:39 +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
|
|
@ -49,7 +49,45 @@ namespace ServerManagerTool
|
|||
public App()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Config.Default.ASMUniqueKey))
|
||||
{
|
||||
Config.Default.ASMUniqueKey = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.DataDir))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.DataDir);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.DataDir = Config.Default.DataDir.Replace(root, root + "\\");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Config.Default.ConfigDirectory))
|
||||
{
|
||||
var root = Path.GetPathRoot(Config.Default.ConfigDirectory);
|
||||
if (!root.EndsWith("\\"))
|
||||
{
|
||||
Config.Default.ConfigDirectory = Config.Default.ConfigDirectory.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