Open file/folder is now cross platform
This commit is contained in:
parent
0df4dfdef5
commit
a47866b6f7
@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<Version>8.3.4.1</Version>
|
<Version>8.3.5.1</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Octokit" Version="1.0.1" />
|
<PackageReference Include="Octokit" Version="1.0.1" />
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AudibleApi" Version="4.6.1.1" />
|
<PackageReference Include="AudibleApi" Version="4.6.2.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dinah.Core" Version="5.0.0.1" />
|
<PackageReference Include="Dinah.Core" Version="5.1.0.1" />
|
||||||
<PackageReference Include="Dinah.EntityFrameworkCore" Version="5.0.0.1" />
|
<PackageReference Include="Dinah.EntityFrameworkCore" Version="5.0.0.1" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.7">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.7">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Dinah.Core" Version="5.0.0.1" />
|
<PackageReference Include="Dinah.Core" Version="5.1.0.1" />
|
||||||
<PackageReference Include="Polly" Version="7.2.3" />
|
<PackageReference Include="Polly" Version="7.2.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -29,33 +29,6 @@ namespace LibationAvalonia
|
|||||||
public static Stream OpenAsset(string assetRelativePath)
|
public static Stream OpenAsset(string assetRelativePath)
|
||||||
=> AssetLoader.Open(new Uri(AssetUriBase, assetRelativePath));
|
=> AssetLoader.Open(new Uri(AssetUriBase, assetRelativePath));
|
||||||
|
|
||||||
|
|
||||||
public static bool GoToFile(string path)
|
|
||||||
=> AppScaffolding.LibationScaffolding.IsWindows ? Go.To.File(path)
|
|
||||||
: GoToFolder(path is null ? string.Empty : Path.GetDirectoryName(path));
|
|
||||||
|
|
||||||
public static bool GoToFolder(string path)
|
|
||||||
{
|
|
||||||
if (AppScaffolding.LibationScaffolding.IsWindows)
|
|
||||||
return Go.To.Folder(path);
|
|
||||||
else if (AppScaffolding.LibationScaffolding.IsLinux)
|
|
||||||
{
|
|
||||||
var startInfo = new System.Diagnostics.ProcessStartInfo()
|
|
||||||
{
|
|
||||||
FileName = "/bin/xdg-open",
|
|
||||||
Arguments = path is null ? string.Empty : $"\"{path}\"",
|
|
||||||
UseShellExecute = false, //Import in Linux environments
|
|
||||||
CreateNoWindow = false,
|
|
||||||
RedirectStandardOutput = true,
|
|
||||||
RedirectStandardError = true
|
|
||||||
};
|
|
||||||
System.Diagnostics.Process.Start(startInfo);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
//Don't know how to do this for mac yet
|
|
||||||
else return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
|||||||
@ -52,7 +52,7 @@ namespace LibationAvalonia.Dialogs
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
App.GoToFolder(dir.ShortPathName);
|
Go.To.Folder(dir.ShortPathName);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,7 +45,7 @@ namespace LibationAvalonia.Dialogs
|
|||||||
|
|
||||||
public void OpenLogFolderButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public void OpenLogFolderButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
App.GoToFolder(((LongPath)Configuration.Instance.LibationFiles).ShortPathName);
|
Go.To.Folder(((LongPath)Configuration.Instance.LibationFiles).ShortPathName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void EditFolderTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
public async void EditFolderTemplateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace LibationAvalonia.Views
|
|||||||
// liberated: open explorer to file
|
// liberated: open explorer to file
|
||||||
var filePath = AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId);
|
var filePath = AudibleFileStorage.Audio.GetPath(libraryBook.Book.AudibleProductId);
|
||||||
|
|
||||||
if (!App.GoToFile(filePath?.ShortPathName))
|
if (!Go.To.File(filePath?.ShortPathName))
|
||||||
{
|
{
|
||||||
var suffix = string.IsNullOrWhiteSpace(filePath) ? "" : $":\r\n{filePath}";
|
var suffix = string.IsNullOrWhiteSpace(filePath) ? "" : $":\r\n{filePath}";
|
||||||
await MessageBox.Show($"File not found" + suffix);
|
await MessageBox.Show($"File not found" + suffix);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user