Skip to content

Pressing Cancel selecting a directory from a file dialog returns directory #1828

@ericwinger

Description

@ericwinger

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

20251021_pharo_returns_path_on_Cancel-2025-10-21_11.59.12.mp4

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions