Attempt to fix File Path handling
- Now uses unix standard frontslashes for directories internally - Converts the backslashes windows returns to frontslashes - Changed default paths
This commit is contained in:
parent
3545afad51
commit
10153a9bd2
|
@ -7,14 +7,13 @@ using System.Text.RegularExpressions;
|
|||
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.VisualTree;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.LogicalTree;
|
||||
|
||||
using BFR.Helpers;
|
||||
using BFR.DataModels;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.LogicalTree;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace BFR
|
||||
{
|
||||
|
@ -26,8 +25,8 @@ namespace BFR
|
|||
public async Task OpenDirectoryButtonClick() => OpenDirectory(await new OpenFolderDialog() { Directory = WorkingDirectory }.ShowAsync(this));
|
||||
public void OpenDirectory(string directory)
|
||||
{
|
||||
WorkingDirectory = directory;
|
||||
AllFiles.ReplaceAll(Directory.GetFiles(WorkingDirectory).Select(x => new FileModel(x)));
|
||||
WorkingDirectory = directory.Replace('\\', '/');
|
||||
AllFiles.ReplaceAll(Directory.GetFiles(WorkingDirectory).Select(x => new FileModel(x.Replace('\\', '/'))));
|
||||
Filter();
|
||||
}
|
||||
|
||||
|
@ -137,7 +136,7 @@ namespace BFR
|
|||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
DataContext = this;
|
||||
OpenDirectory(Environment.OSVersion.Platform == PlatformID.Win32NT ? @"C:\Users" : @"\home");
|
||||
OpenDirectory(Environment.OSVersion.Platform == PlatformID.Win32NT ? @"C:/Users/" : @"/home/");
|
||||
HandleEvents = true;
|
||||
OperationsListBox = this.Find<ListBox>("OperationsListBox");
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
get => $"{Directory}{FullName}";
|
||||
set
|
||||
{
|
||||
FullName = value.Substring(value.LastIndexOf('\\') + 1);
|
||||
Directory = value.Substring(0, value.LastIndexOf('\\') + 1);
|
||||
FullName = value.Substring(value.LastIndexOf('/') + 1);
|
||||
Directory = value.Substring(0, value.LastIndexOf('/') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user