Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File-in by drag and drop runs into DNU #itemsForFile: #17480

Open
riuttner opened this issue Dec 2, 2024 · 1 comment
Open

File-in by drag and drop runs into DNU #itemsForFile: #17480

riuttner opened this issue Dec 2, 2024 · 1 comment

Comments

@riuttner
Copy link
Contributor

riuttner commented Dec 2, 2024

When dropping an arbitrary ST file for file-in on an arbitrary package (P13 latest under W10, but should fail on all platforms), I always get the following DNU:

Message not understood: StFileSystemPresenter class >> #itemsForFile:

This happens in the the first executed method line of ExternalDropHandler class>>#lookupServiceBasedHandler: before the #reject: is called:

lookupServiceBasedHandler: aFileReference
	"the file was just droped, let's do our job"
	| services theOne |

	services := (Smalltalk tools fileList itemsForFile: aFileReference)
		reject: [:svc | self unwantedSelectors includes: svc selector].

Looking at earlier pharo releases (my image created on Nov 14th yet worked), I found that there was a thorough change on dealing with Smalltalk tools fileList such that formerly there was a class FileList returned implementing the following:

itemsForFile: file
	"Answer a list of services appropriate for a file of the given full name"

	^ FileServices itemsForFile: file fullName

As opposed to that, the latest pharo release returns a Presenter instead, which will not work in principle for the application case of handling a dropped ST file. Thus I propose the following hotfix for ExternalDropHandler class>>#lookupServiceBasedHandler: (first lines shown only):

lookupServiceBasedHandler: aFileReference
	"the file was just droped, let's do our job"
	| services theOne |

	services := (FileServices itemsForFile: aFileReference fullName)
		reject: ...

For a final fix it will maybe better to rely on a DefaultExternalDropHandler instead which already implements a method doing something equivalent, see DefaultExternalDropHandler>>#servicesForFileNamed:

@guillep
Copy link
Member

guillep commented Dec 4, 2024

Thanks Richard, I'm going to tag it. This is due to the introduction of the new FileList rewritten in Spec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants