mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
IOUtils Changes
- added new NormalizeFolder method to format the path parameter, so that it is formed correctly. If the path is a local root path (eg. d:) then it must end with \\. If the path is not a root path, or is a Unc path, then any ending \\ must be removed. This fix was due to an issue with the previous code, as it kept appending a \ to the end when the path was a Unc path.
This commit is contained in:
parent
14cff018cd
commit
bbaad6099f
9 changed files with 210 additions and 222 deletions
|
|
@ -57,38 +57,22 @@ namespace ServerManagerTool
|
|||
|
||||
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 + "\\");
|
||||
}
|
||||
Config.Default.DataDir = IOUtils.NormalizeFolder(Config.Default.DataDir);
|
||||
}
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
Config.Default.ConfigDirectory = IOUtils.NormalizeFolder(Config.Default.ConfigDirectory);
|
||||
}
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
Config.Default.BackupPath = IOUtils.NormalizeFolder(Config.Default.BackupPath);
|
||||
}
|
||||
|
||||
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 + "\\");
|
||||
}
|
||||
Config.Default.AutoUpdate_CacheDir = IOUtils.NormalizeFolder(Config.Default.AutoUpdate_CacheDir);
|
||||
}
|
||||
|
||||
App.Instance = this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue