Skip to content

Commit 1ad9903

Browse files
committed
Added NativeFolderView
1 parent 8cbb0b4 commit 1ad9903

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

src/Files.App.Storage/Files.App.Storage.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
66
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
77
<Nullable>enable</Nullable>
8+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
89
<IsTrimmable>true</IsTrimmable>
910
<Configurations>Debug;Release;Stable;Preview;Store</Configurations>
1011
<Platforms>x86;x64;arm64</Platforms>

src/Files.App.Storage/Storables/Native/NativeFolder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ unsafe IEnumerable<NativeStorable> GetChildren()
2828
(Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in IEnumShellItems.Guid)),
2929
(void**)pEnumShellItems.GetAddressOf());
3030

31-
ComPtr<IShellItem> pShellItem = default;
32-
while (pEnumShellItems.Get()->Next(1, pShellItem.GetAddressOf()) == HRESULT.S_OK)
33-
yield return NativeStorable(pShellItem);
31+
ComPtr<IShellItem> pShellItem = default;
32+
while (pEnumShellItems.Get()->Next(1, pShellItem.GetAddressOf()) == HRESULT.S_OK)
33+
yield return NativeStorable(pShellItem);
3434
}
3535
}
3636
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2024 Files Community
2+
// Licensed under the MIT License. See the LICENSE.
3+
4+
namespace Files.App.Storage.Storables
5+
{
6+
/// <summary>
7+
/// Represents a folder object that is natively supported by Windows Shell API.
8+
/// </summary>
9+
public class NativeFolderView /*:IFolderView*/
10+
{
11+
}
12+
}

src/Files.App.Storage/Storables/Native/NativeStorable.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public string GetPropertyAsync(string id)
9898

9999
using ComHeapPtr<LPWSTR> pPropertyValue;
100100
hr = pShellItem2.Get()->GetString(
101-
propertyKey,
102-
(void**)pPropertyValue.GetAddressOf());
101+
&propertyKey,
102+
pPropertyValue.GetAddressOf());
103103

104104
return szPropertyValue.Get()->ToString();
105105
}

0 commit comments

Comments
 (0)