[fix?:] windows paths (ai-based since windows is boring)
This commit is contained in:
@@ -14,14 +14,14 @@ public partial class EditorWindow : Window
|
||||
try
|
||||
{
|
||||
InitializeComponent();
|
||||
this.filename = filename;
|
||||
if (!string.IsNullOrWhiteSpace(filename) && File.Exists(filename))
|
||||
this.filename = PathUtilities.NormalizeFileSystemPath(filename);
|
||||
if (!string.IsNullOrWhiteSpace(this.filename) && File.Exists(this.filename))
|
||||
{
|
||||
var content = TbContent;
|
||||
if (content != null) content.Text = File.ReadAllText(this.filename);
|
||||
Title = "Wiki Editor - " + filename;
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(filename))
|
||||
else if (!string.IsNullOrWhiteSpace(this.filename))
|
||||
{
|
||||
MessageBox.Show(null, "Die Datei existiert nicht", "Fehler");
|
||||
Close();
|
||||
@@ -49,7 +49,8 @@ public partial class EditorWindow : Window
|
||||
private void BtnSaveAs_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show(null,
|
||||
"Feature noch nicht implemetiert.\nErstelle neue Dateien unter " + Global._instance.wiki_storage_path,
|
||||
"Feature noch nicht implemetiert.\nErstelle neue Dateien unter " +
|
||||
PathUtilities.NormalizeFileSystemPath(Global._instance.wiki_storage_path),
|
||||
"Fehler");
|
||||
}
|
||||
|
||||
@@ -65,4 +66,4 @@ public partial class EditorWindow : Window
|
||||
MainWindow._instance.PopulateNavTree();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-3
@@ -13,7 +13,7 @@ public class WikiService
|
||||
// prefer global wiki storage path if configured
|
||||
if (Global._instance != null && !string.IsNullOrWhiteSpace(Global._instance.wiki_storage_path))
|
||||
{
|
||||
var cfg = Global._instance.wiki_storage_path;
|
||||
var cfg = PathUtilities.NormalizeFileSystemPath(Global._instance.wiki_storage_path);
|
||||
WikiRootFullPath = Path.IsPathRooted(cfg)
|
||||
? cfg
|
||||
: Path.Combine(Directory.GetCurrentDirectory(), cfg);
|
||||
@@ -25,8 +25,11 @@ public class WikiService
|
||||
wikiRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"logofclient",
|
||||
"wiki");
|
||||
wikiRoot = PathUtilities.NormalizeFileSystemPath(wikiRoot);
|
||||
WikiRoot = wikiRoot;
|
||||
WikiRootFullPath = Path.Combine(Directory.GetCurrentDirectory(), wikiRoot);
|
||||
WikiRootFullPath = Path.IsPathRooted(wikiRoot)
|
||||
? wikiRoot
|
||||
: Path.Combine(Directory.GetCurrentDirectory(), wikiRoot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +71,4 @@ public class WikiService
|
||||
if (!File.Exists(path)) return Task.FromResult<string?>(null);
|
||||
return File.ReadAllTextAsync(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user