mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-04 12:04:20 +08:00
Fix livebook:// support
This commit is contained in:
parent
73c0f1b45c
commit
e3e60b5d0c
4 changed files with 27 additions and 6 deletions
|
@ -110,7 +110,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
}
|
||||
|
||||
for url in urls {
|
||||
ElixirKit.API.publish("open", "file://\(url.path)")
|
||||
if url.scheme! == "livebook" {
|
||||
let string = url.absoluteString
|
||||
ElixirKit.API.publish("open", string)
|
||||
}
|
||||
if url.scheme! == "file" {
|
||||
// Livebook.Utils.expand_desktop_url/1 URL-escapes so here we pass unescaped URL
|
||||
// as not to escape twice. This is not a problem for livebook:// url above.
|
||||
let string = "file://\(url.path)"
|
||||
ElixirKit.API.publish("open", string)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ Section "Install Handlers"
|
|||
|
||||
DetailPrint "Registering livebook URL Handler"
|
||||
DeleteRegKey HKCU "Software\Classes\livebook"
|
||||
WriteRegStr HKCU "Software\Classes\livebook" "" "Livebook URL Protocol"
|
||||
WriteRegStr HKCU "Software\Classes\livebook" "" "URL:Livebook Protocol"
|
||||
WriteRegStr HKCU "Software\Classes\livebook" "URL Protocol" ""
|
||||
WriteRegStr HKCU "Software\Classes\livebook\shell" "" ""
|
||||
WriteRegStr HKCU "Software\Classes\livebook\shell\open" "" ""
|
||||
|
|
|
@ -18,7 +18,18 @@ static class LivebookMain
|
|||
|
||||
if (args.Length == 1 && args[0].StartsWith(prefix))
|
||||
{
|
||||
url = $"file://{args[0].Remove(0, prefix.Length)}";
|
||||
url = args[0].Substring(prefix.Length);
|
||||
var uri = new System.Uri(url);
|
||||
if (uri.Scheme == "livebook")
|
||||
{
|
||||
url = uri.AbsoluteUri;
|
||||
}
|
||||
if (uri.Scheme == "file")
|
||||
{
|
||||
// Livebook.Utils.expand_desktop_url/1 URL-escapes so here we pass unescaped URL
|
||||
// as not to escape twice. This is not a problem for livebook:// url above.
|
||||
url = "file://" + uri.LocalPath;
|
||||
}
|
||||
}
|
||||
|
||||
var logPath = getLogPath();
|
||||
|
|
|
@ -13,13 +13,14 @@ echo "Setting registry to use $exe"
|
|||
echo "!!!!!!"
|
||||
echo
|
||||
|
||||
# .livemd
|
||||
reg add "$root\\.livemd" //d "Livebook.LiveMarkdown" //f
|
||||
reg add "$root\\Livebook.LiveMarkdown\\DefaultIcon" //d "$exe,1" //f
|
||||
reg add "$root\\Livebook.LiveMarkdown\\shell\\open\\command" //d "$exe open:%1" //f
|
||||
reg add "$root\\Livebook.LiveMarkdown\\shell\\open\\command" //d "\"$exe\" \"open:%1\"" //f
|
||||
|
||||
# livebook://
|
||||
reg add "$root\\livebook" //d "URL:Livebook Protocol" //f
|
||||
reg add "$root\\livebook" //v "URL Protocol" //f
|
||||
reg add "$root\\Livebook\\DefaultIcon" //d "$exe,1" //f
|
||||
reg add "$root\\livebook\\shell\\open\\command" //d "$exe open:%1" //f
|
||||
reg add "$root\\livebook\\shell\\open\\command" //d "\"$exe\" \"open:%1\"" //f
|
||||
|
||||
dotnet run --no-build
|
||||
|
|
Loading…
Add table
Reference in a new issue