Skip to content

Commit 8908a5b

Browse files
Fix for hardcoded OS drives (#9748)
1 parent 34e1974 commit 8908a5b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/Files.Uwp/Helpers/CommonPaths.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public static class CommonPaths
2626

2727
public static readonly string HomePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
2828

29+
public static readonly string SystemRootPath = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
30+
2931
public static Dictionary<string, string> ShellPlaces = new Dictionary<string, string>() {
3032
{ "::{645FF040-5081-101B-9F08-00AA002F954E}", RecycleBinPath },
3133
{ "::{5E5F29CE-E0A8-49D3-AF32-7A7BDC173478}", "Home".GetLocalized() /*MyComputerPath*/ },

src/Files.Uwp/Helpers/UIHelpers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Newtonsoft.Json;
33
using System;
44
using System.Collections.Generic;
5+
using System.IO;
56
using System.Linq;
67
using System.Threading.Tasks;
78
using Windows.ApplicationModel.AppService;
@@ -94,7 +95,7 @@ public static async Task<BitmapImage> GetIconResource(int index)
9495

9596
private static async Task<IEnumerable<IconFileInfo>> LoadSidebarIconResources()
9697
{
97-
const string imageres = @"C:\Windows\System32\imageres.dll";
98+
string imageres = Path.Combine(CommonPaths.SystemRootPath, "System32", "imageres.dll");
9899
var imageResList = await UIHelpers.LoadSelectedIconsAsync(imageres, new List<int>() {
99100
Constants.ImageRes.RecycleBin,
100101
Constants.ImageRes.NetworkDrives,

src/Files.Uwp/Views/Pages/PropertiesCustomization.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
using Files.Uwp.Filesystem;
2+
using Files.Uwp.Helpers;
23
using Files.Uwp.ViewModels.Properties;
4+
using System;
5+
using System.IO;
36
using System.Threading.Tasks;
47
using Windows.UI.Xaml;
58
using Windows.UI.Xaml.Controls;
@@ -16,7 +19,7 @@ public PropertiesCustomization()
1619

1720
private void CustomIconsSelectorFrame_Loaded(object sender, RoutedEventArgs e)
1821
{
19-
string initialPath = @"C:\Windows\System32\SHELL32.dll";
22+
string initialPath = Path.Combine(CommonPaths.SystemRootPath, "System32", "SHELL32.dll");
2023
var item = (BaseProperties as FileProperties)?.Item ?? (BaseProperties as FolderProperties)?.Item;
2124
(sender as Frame).Navigate(typeof(CustomFolderIcons), new IconSelectorInfo
2225
{

0 commit comments

Comments
 (0)