mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-06-30 20:10:57 +12:00
Fix show details action failing for windows root drives
This commit is contained in:
parent
d1216811c8
commit
4048e3b730
|
@ -22,16 +22,24 @@ public class OpenNativeFileDetailsAction implements LeafAction {
|
|||
var e = entry.getRawFileEntry().getPath();
|
||||
switch (OsType.getLocal()) {
|
||||
case OsType.Windows windows -> {
|
||||
var content = String.format(
|
||||
"""
|
||||
$shell = New-Object -ComObject Shell.Application; $shell.NameSpace('%s').ParseName('%s').InvokeVerb('Properties')
|
||||
""",
|
||||
FileNames.getParent(e), FileNames.getFileName(e));
|
||||
var parent = FileNames.getParent(e);
|
||||
// If we execute this on a drive root there will be no parent, so we have to check for that!
|
||||
var content = parent != null
|
||||
? String.format(
|
||||
"$shell = New-Object -ComObject Shell.Application; $shell.NameSpace('%s').ParseName('%s').InvokeVerb('Properties')",
|
||||
FileNames.getParent(e), FileNames.getFileName(e))
|
||||
: String.format(
|
||||
"$shell = New-Object -ComObject Shell.Application; $shell.NameSpace('%s').Self.InvokeVerb('Properties')",
|
||||
e);
|
||||
|
||||
// The Windows shell invoke verb functionality behaves kinda weirdly and only shows the window as long as the parent process is running.
|
||||
// The Windows shell invoke verb functionality behaves kinda weirdly and only shows the window as
|
||||
// long as the parent process is running.
|
||||
// So let's keep one process running
|
||||
if (powershell == null) {
|
||||
powershell = new LocalStore().control().subShell(ShellDialects.POWERSHELL).start();
|
||||
powershell = new LocalStore()
|
||||
.control()
|
||||
.subShell(ShellDialects.POWERSHELL)
|
||||
.start();
|
||||
}
|
||||
|
||||
powershell.command(content).notComplex().execute();
|
||||
|
|
Loading…
Reference in a new issue