[Pharo-project] FreeType fonts scan annoyance on windows

Igor Stasenko siguctua at gmail.com
Wed Oct 13 12:14:39 EDT 2010


If you're on Windows, a freetype searching fonts everywhere on all
drive letters.
This causes opening annoying 'Insert disk in drive X:' dialog.

guessWindowsFontFolderPath
	"Guess the location of the Windows font folder"
	| possibles |

	possibles := Set new.
	'cdefghijklmnopqrstuvwxyz' do:[:drive |
		#('\windows\fonts' '\winnt\fonts') do:[:path | | d |
			(d := FileDirectory on: drive asString, ':', path) exists
				ifTrue:[possibles add: d]]].
	possibles := possibles asSortedCollection: [:a :b | a directoryEntry
creationTime >= b  directoryEntry creationTime].
	possibles ifNotEmpty:[^possibles first pathName].
	^nil
			
Here what i found occasionally, when read ReadFile() function
documentation in MSDN:

If you are attempting to read from a floppy drive that does not have a
floppy disk, the system displays a message box that prompts the user
to retry the operation. To prevent the system from displaying this
message box, call the SetErrorMode function with
SEM_NOOPENFILEERRORBOX.

But it will require changing VM to call SetErrorMode() during startup
to prevent these promts from appearing.

-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list