From 903674efa8cf9a00962750918ffb2a1eb77bd5ef Mon Sep 17 00:00:00 2001 From: yicheng Date: Sun, 13 Jan 2019 10:27:44 +0800 Subject: [PATCH] Fixed: dashbaord 404 when put clashx in directory has spaces inside --- ClashX/AppDelegate.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ClashX/AppDelegate.swift b/ClashX/AppDelegate.swift index d0743b8..fe4a673 100644 --- a/ClashX/AppDelegate.swift +++ b/ClashX/AppDelegate.swift @@ -224,8 +224,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { if (ConfigManager.shared.isRunning){return} // setup ui config first - if let htmlPath = Bundle.main.path(forResource: "index", ofType: "html", inDirectory: "dashboard") , - let uiPath = URL(string: htmlPath)?.deletingLastPathComponent().absoluteString.dropLast() { + if let htmlPath = Bundle.main.path(forResource: "index", ofType: "html", inDirectory: "dashboard") { + let uiPath = URL(fileURLWithPath: htmlPath).deletingLastPathComponent().path let path = String(uiPath) let length = path.count + 1 let buffer = UnsafeMutablePointer.allocate(capacity: length)