Add Git overlay, operation tools, and virtualized preview so large folders stay responsive.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
62
src/Explorer.Windows/WindowsWorkspaceLauncher.cs
Normal file
62
src/Explorer.Windows/WindowsWorkspaceLauncher.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System.Diagnostics;
|
||||
using Explorer.Application;
|
||||
using Explorer.Domain;
|
||||
|
||||
namespace Explorer.Windows;
|
||||
|
||||
public sealed class WindowsWorkspaceLauncher : IWorkspaceLauncher
|
||||
{
|
||||
public void OpenTerminal(string directory)
|
||||
{
|
||||
var dir = PathRules.FromExtended(directory);
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (TryStart("wt.exe", "-d " + Quote(dir)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TryStart("cmd.exe", "/k cd /d " + Quote(dir));
|
||||
}
|
||||
|
||||
public bool TryOpenInCursor(string directory)
|
||||
{
|
||||
var dir = PathRules.FromExtended(directory);
|
||||
if (!Directory.Exists(dir))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var cursor = CursorLocator.Find();
|
||||
if (cursor is not null)
|
||||
{
|
||||
return TryStart(cursor, Quote(dir));
|
||||
}
|
||||
|
||||
return TryStart("cursor", Quote(dir));
|
||||
}
|
||||
|
||||
private static bool TryStart(string fileName, string arguments)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = fileName,
|
||||
Arguments = arguments,
|
||||
UseShellExecute = true
|
||||
});
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static string Quote(string path)
|
||||
=> path.StartsWith('"') ? path : "\"" + path.Replace("\"", "\\\"") + "\"";
|
||||
}
|
||||
Reference in New Issue
Block a user