mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Use QUrl to parse fileUrl
CURA-3495
This commit is contained in:
parent
f3167bb84b
commit
9e5513ade6
1 changed files with 3 additions and 8 deletions
|
@ -1269,15 +1269,10 @@ class CuraApplication(QtApplication):
|
|||
"""
|
||||
Checks if the given file URL is a valid project file.
|
||||
"""
|
||||
file_url_prefix = 'file:///'
|
||||
|
||||
file_name = file_url
|
||||
if file_name.startswith(file_url_prefix):
|
||||
file_name = file_name[len(file_url_prefix):]
|
||||
|
||||
workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_name)
|
||||
file_path = QUrl(file_url).toLocalFile()
|
||||
workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path)
|
||||
if workspace_reader is None:
|
||||
return False # non-project files won't get a reader
|
||||
|
||||
result = workspace_reader.preRead(file_name, show_dialog=False)
|
||||
result = workspace_reader.preRead(file_path, show_dialog=False)
|
||||
return result == WorkspaceReader.PreReadResult.accepted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue