Skip to content

Commit

Permalink
Support drives too
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimecbernardo committed Oct 28, 2022
1 parent e0baf30 commit 7a49aac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions installer/PowerToysSetup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,9 @@
<RegistryKey Root="HKLM" Key="Software\Classes\AllFileSystemObjects\ShellEx\ContextMenuHandlers\FileLocksmithExt">
<RegistryValue Type="string" Value="{84D68575-E186-46AD-B0CB-BAEB45EE29C0}"/>
</RegistryKey>
<RegistryKey Root="HKLM" Key="Software\Classes\Drive\ShellEx\ContextMenuHandlers\FileLocksmithExt">
<RegistryValue Type="string" Value="{84D68575-E186-46AD-B0CB-BAEB45EE29C0}"/>
</RegistryKey>
</Component>
</DirectoryRef>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ std::vector<ProcessResult> find_processes_recursive(const std::vector<std::wstri

for (const auto& [dir_kernel_name, dir_path] : kernel_names_dirs)
{
if (starts_with(kernel_name, dir_kernel_name + L"\\"))
if (starts_with(kernel_name, dir_kernel_name + (dir_kernel_name.length()>0&&dir_kernel_name[dir_kernel_name.length()-1]!=L'\\' ? L"\\" : L"")))
{
return dir_path + kernel_name.substr(dir_kernel_name.size());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,26 @@ public object Convert(object value, Type targetType, object parameter, string la
{
return string.Empty;
}
else if (paths.Length == 1)

string firstPath = paths[0];
firstPath = Path.GetFileName(paths[0]);
if (string.IsNullOrEmpty(firstPath))
{
firstPath = Path.GetDirectoryName(paths[0]);
}

if (string.IsNullOrEmpty(firstPath))
{
firstPath = Path.GetPathRoot(paths[0]);
}

if (paths.Length == 1)
{
return Path.GetFileName(paths[0]);
return firstPath;
}
else
{
return Path.GetFileName(paths[0]) + "; +" + (paths.Length - 1);
return firstPath + "; +" + (paths.Length - 1);
}
}

Expand Down

0 comments on commit 7a49aac

Please sign in to comment.