Convert URLs to paths returned from `NSOpenPanel` using `[Url path]`

Antonio Scandurra created

Change summary

gpui/src/platform/mac/platform.rs | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

Detailed changes

gpui/src/platform/mac/platform.rs 🔗

@@ -283,13 +283,10 @@ impl platform::Platform for MacPlatform {
                     let urls = panel.URLs();
                     for i in 0..urls.count() {
                         let url = urls.objectAtIndex(i);
-                        let string = url.absoluteString();
-                        let string = std::ffi::CStr::from_ptr(string.UTF8String())
+                        let path = std::ffi::CStr::from_ptr(url.path().UTF8String())
                             .to_string_lossy()
                             .to_string();
-                        if let Some(path) = string.strip_prefix("file://") {
-                            result.push(PathBuf::from(path));
-                        }
+                        result.push(PathBuf::from(path));
                     }
                     Some(result)
                 } else {