mirror of
https://github.com/AssetRipper/AssetRipper.NativeDialogs.git
synced 2026-11-13 18:06:41 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49e71fc0a5 | ||
|
|
0ca1fdb1dc | ||
|
|
63278e1a51 | ||
|
|
43573a623e | ||
|
|
da64c1a6d0 | ||
|
|
76e1f42c15 | ||
|
|
1e60e65ae4 | ||
|
|
efd1956ab9 |
No files matched your search
@@ -22,11 +22,11 @@ jobs:
|
||||
- { name: mac_arm64, os: macos-latest, runtime: osx-arm64, executable: AssetRipper.NativeDialogs.Example }
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
# https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/cross-compile#linux
|
||||
- name: Install Arm64 Dependencies
|
||||
@@ -52,14 +52,14 @@ jobs:
|
||||
run: ls -R ./AssetRipper.NativeDialogs.Example/bin/Release/
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: Example_${{ matrix.config.name }}
|
||||
path: |
|
||||
./AssetRipper.NativeDialogs.Example/bin/Release/net9.0/${{ matrix.config.runtime }}/publish/${{ matrix.config.executable }}
|
||||
./AssetRipper.NativeDialogs.Example/bin/Release/net9.0/${{ matrix.config.runtime }}/publish/*.dll
|
||||
./AssetRipper.NativeDialogs.Example/bin/Release/net9.0/${{ matrix.config.runtime }}/publish/*.so
|
||||
./AssetRipper.NativeDialogs.Example/bin/Release/net9.0/${{ matrix.config.runtime }}/publish/*.dylib
|
||||
./AssetRipper.NativeDialogs.Example/bin/Release/net10.0/${{ matrix.config.runtime }}/publish/${{ matrix.config.executable }}
|
||||
./AssetRipper.NativeDialogs.Example/bin/Release/net10.0/${{ matrix.config.runtime }}/publish/*.dll
|
||||
./AssetRipper.NativeDialogs.Example/bin/Release/net10.0/${{ matrix.config.runtime }}/publish/*.so
|
||||
./AssetRipper.NativeDialogs.Example/bin/Release/net10.0/${{ matrix.config.runtime }}/publish/*.dylib
|
||||
if-no-files-found: error
|
||||
|
||||
publish_web_api:
|
||||
@@ -76,11 +76,11 @@ jobs:
|
||||
- { name: mac_arm64, os: macos-latest, runtime: osx-arm64, executable: AssetRipper.NativeDialogs.WebApi }
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
# https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/cross-compile#linux
|
||||
- name: Install Arm64 Dependencies
|
||||
@@ -106,12 +106,12 @@ jobs:
|
||||
run: ls -R ./AssetRipper.NativeDialogs.WebApi/bin/Release/
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: WebApi_${{ matrix.config.name }}
|
||||
path: |
|
||||
./AssetRipper.NativeDialogs.WebApi/bin/Release/net9.0/${{ matrix.config.runtime }}/publish/${{ matrix.config.executable }}
|
||||
./AssetRipper.NativeDialogs.WebApi/bin/Release/net9.0/${{ matrix.config.runtime }}/publish/*.dll
|
||||
./AssetRipper.NativeDialogs.WebApi/bin/Release/net9.0/${{ matrix.config.runtime }}/publish/*.so
|
||||
./AssetRipper.NativeDialogs.WebApi/bin/Release/net9.0/${{ matrix.config.runtime }}/publish/*.dylib
|
||||
./AssetRipper.NativeDialogs.WebApi/bin/Release/net10.0/${{ matrix.config.runtime }}/publish/${{ matrix.config.executable }}
|
||||
./AssetRipper.NativeDialogs.WebApi/bin/Release/net10.0/${{ matrix.config.runtime }}/publish/*.dll
|
||||
./AssetRipper.NativeDialogs.WebApi/bin/Release/net10.0/${{ matrix.config.runtime }}/publish/*.so
|
||||
./AssetRipper.NativeDialogs.WebApi/bin/Release/net10.0/${{ matrix.config.runtime }}/publish/*.dylib
|
||||
if-no-files-found: error
|
||||
@@ -3,6 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PublishAot>true</PublishAot>
|
||||
<CETCompat>false</CETCompat>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<PublishAot>true</PublishAot>
|
||||
<CETCompat>false</CETCompat>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36301.6
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetRipper.NativeDialogs.Example", "AssetRipper.NativeDialogs.Example\AssetRipper.NativeDialogs.Example.csproj", "{637F54CA-046C-41C3-BC47-488F6CAB4A58}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetRipper.NativeDialogs", "AssetRipper.NativeDialogs\AssetRipper.NativeDialogs.csproj", "{B666C286-5649-456B-A356-FB91DC0DE0C3}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
.gitignore = .gitignore
|
||||
.github\dependabot.yml = .github\dependabot.yml
|
||||
Directory.Build.props = Directory.Build.props
|
||||
LICENSE = LICENSE
|
||||
.github\workflows\publish.yml = .github\workflows\publish.yml
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetRipper.NativeDialogs.WebApi", "AssetRipper.NativeDialogs.WebApi\AssetRipper.NativeDialogs.WebApi.csproj", "{18204EF5-F8B0-4314-BF6C-3FBB2AD6FB12}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{637F54CA-046C-41C3-BC47-488F6CAB4A58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{637F54CA-046C-41C3-BC47-488F6CAB4A58}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{637F54CA-046C-41C3-BC47-488F6CAB4A58}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{637F54CA-046C-41C3-BC47-488F6CAB4A58}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B666C286-5649-456B-A356-FB91DC0DE0C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B666C286-5649-456B-A356-FB91DC0DE0C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B666C286-5649-456B-A356-FB91DC0DE0C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B666C286-5649-456B-A356-FB91DC0DE0C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{18204EF5-F8B0-4314-BF6C-3FBB2AD6FB12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{18204EF5-F8B0-4314-BF6C-3FBB2AD6FB12}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{18204EF5-F8B0-4314-BF6C-3FBB2AD6FB12}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{18204EF5-F8B0-4314-BF6C-3FBB2AD6FB12}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1D6CFC53-7372-4EF6-B954-364EC2218A9B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,14 @@
|
||||
<Solution>
|
||||
<Folder Name="/Solution Items/">
|
||||
<File Path=".editorconfig" />
|
||||
<File Path=".github/dependabot.yml" />
|
||||
<File Path=".github/workflows/publish.yml" />
|
||||
<File Path=".gitignore" />
|
||||
<File Path="Directory.Build.props" />
|
||||
<File Path="LICENSE" />
|
||||
<File Path="README.md" />
|
||||
</Folder>
|
||||
<Project Path="AssetRipper.NativeDialogs.Example/AssetRipper.NativeDialogs.Example.csproj" />
|
||||
<Project Path="AssetRipper.NativeDialogs.WebApi/AssetRipper.NativeDialogs.WebApi.csproj" />
|
||||
<Project Path="AssetRipper.NativeDialogs/AssetRipper.NativeDialogs.csproj" />
|
||||
</Solution>
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<CETCompat>false</CETCompat>
|
||||
|
||||
<PackageId>AssetRipper.NativeDialogs</PackageId>
|
||||
<PackageTags>C# file</PackageTags>
|
||||
@@ -13,7 +14,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.26100.2" />
|
||||
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.26100.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Buffers;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Versioning;
|
||||
using TerraFX.Interop.Windows;
|
||||
@@ -37,7 +36,7 @@ public static class OpenFileDialog
|
||||
new Span<char>(buffer).Clear();
|
||||
|
||||
fixed (char* bufferPtr = buffer)
|
||||
fixed (char* filterPtr = "All Files\0*.*\0")
|
||||
fixed (char* filterPtr = "All Files (*.*)\0*.*\0\0")
|
||||
{
|
||||
OPENFILENAMEW ofn = default;
|
||||
ofn.lStructSize = (uint)Unsafe.SizeOf<OPENFILENAMEW>();
|
||||
@@ -46,7 +45,7 @@ public static class OpenFileDialog
|
||||
ofn.nMaxFile = (uint)buffer.Length;
|
||||
ofn.lpstrFilter = filterPtr;
|
||||
ofn.nFilterIndex = 1; // The first pair of strings has an index value of 1.
|
||||
ofn.Flags = OFN.OFN_PATHMUSTEXIST | OFN.OFN_FILEMUSTEXIST;
|
||||
ofn.Flags = OFN.OFN_PATHMUSTEXIST | OFN.OFN_FILEMUSTEXIST | OFN.OFN_EXPLORER;
|
||||
if (Windows.GetOpenFileNameW(&ofn))
|
||||
{
|
||||
int length = Array.IndexOf(buffer, '\0');
|
||||
@@ -116,7 +115,7 @@ public static class OpenFileDialog
|
||||
new Span<char>(buffer).Clear();
|
||||
|
||||
fixed (char* bufferPtr = buffer)
|
||||
fixed (char* filterPtr = "All Files\0*.*\0")
|
||||
fixed (char* filterPtr = "All Files (*.*)\0*.*\0\0")
|
||||
{
|
||||
OPENFILENAMEW ofn = default;
|
||||
ofn.lStructSize = (uint)Unsafe.SizeOf<OPENFILENAMEW>();
|
||||
|
||||
@@ -61,6 +61,11 @@ internal static class ProcessExecutor
|
||||
[SupportedOSPlatform("linux")]
|
||||
public static async Task<bool> HasCommand(string command)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrEmpty(command);
|
||||
if (!File.Exists("/bin/bash"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
string? result = await TryRun("/bin/bash", "-c", $"command -v {EscapeString(command)}");
|
||||
return !string.IsNullOrEmpty(result);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public static class SaveFileDialog
|
||||
char[] buffer = ArrayPool<char>.Shared.Rent(ushort.MaxValue + 1); // Should be enough for the overwhelming majority of cases.
|
||||
new Span<char>(buffer).Clear();
|
||||
|
||||
string filter = "All Files\0*.*\0\0";
|
||||
string filter = "All Files (*.*)\0*.*\0\0";
|
||||
|
||||
fixed (char* bufferPtr = buffer)
|
||||
fixed (char* filterPtr = filter)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>Latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||
|
||||
<VersionPrefix>1.0.1</VersionPrefix>
|
||||
<Copyright>Copyright (c) 2025 ds5678</Copyright>
|
||||
<VersionPrefix>1.1.1</VersionPrefix>
|
||||
<Copyright>Copyright (c) 2026 ds5678</Copyright>
|
||||
<Authors>ds5678</Authors>
|
||||
<Company>AssetRipper</Company>
|
||||
<Description>Cross platform library for native file dialogs.</Description>
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
# AssetRipper.NativeDialogs
|
||||
|
||||
A cross-platform library for picking files and folders in .NET applications.
|
||||
|
||||
## CETCompat requirement (Windows)
|
||||
|
||||
On Windows, downstream projects must disable `CETCompat`. Leaving it enabled may cause crashes when opening native file dialogs.
|
||||
|
||||
Add the following to the consuming project `.csproj` file:
|
||||
|
||||
```xml
|
||||
<PropertyGroup>
|
||||
<CETCompat>false</CETCompat>
|
||||
</PropertyGroup>
|
||||
```
|
||||
### Why?
|
||||
|
||||
Native file dialogs can load .NET Framework components that do not support CET mitigations. When CETCompat is enabled, this may lead to shadow stack violations and runtime crashes. CET affects the entire process, so it must be disabled by the application that uses this library.
|
||||
|
||||
### Similar issues in other repositories
|
||||
- https://github.com/dotnet/wpf/issues/10483#issuecomment-2669897861
|
||||
- https://github.com/microsoft/PowerToys/issues/37254#issue-2826006174
|
||||
Reference in new issue
Block a user