Spec icon indicating copy to clipboard operation
Spec copied to clipboard

Pressing Cancel selecting a directory from a file dialog returns directory

Open ericwinger opened this issue 4 months ago • 2 comments

In Pharo 13, executing this code in a Playground opens a modal dialog with the opportunity to select a dialog.

| path |
path :=  StPharoApplication current selectDirectoryTitle:
	         'Choose directory'.
path 

However, if I press Cancel, a FileReference is returned. I expect that nil should be returned so I know that the user canceled the operation and my application can act accordingly.

Please let me know if there is a different way I should select a directory in Pharo13.

I also tried the following expression but it gets an error Instance of ByteString did not understand #exists because an expected FileReference was a string.

UIManager default
		        chooseDirectory: 'Choose Client Library Directory'
		        from:
		        '$HOME'
			        asFileReference.

Pharo 13.1.0 Build information: Pharo-13.1.0+SNAPSHOT.build.705.sha.3ff27d6817cce1921739fdd49bd8a14301cefe74 (64 Bit) Build date: 13 October 2025

https://github.com/user-attachments/assets/f360fbcb-1130-473f-8ccf-00f982753c96

ericwinger avatar Oct 21 '25 19:10 ericwinger

Tx for your report.

Ducasse avatar Oct 23 '25 13:10 Ducasse

I checked and I have the same behavior in Pharo 14 - which looks wrong to me.

Ducasse avatar Oct 23 '25 13:10 Ducasse