Broken Dialog_Pickfile on UNIX?
QUESTION: Does the IDL routine Dialog_Pickfile work correctly on UNIX machines? Consider this code, which is executed on my LINUX machine. I am trying to put a good default selection into the initial Dialog_Pickfile window.
IDL> theDirectory = '~/IDL/coyote/' IDL> theFile = 'fsc_surface.pro' IDL> selectedFile = Dialog_Pickfile(FILE=theFile, PATH=theDirectory)
You see the output below. Notice the text in the Selection box. Shouldn't that just be the name of the file?
|Dialog_Pickfile appears to be broken on UNIX machines.|
If I click the OK button, and print the result, I see this.
IDL> Print, selectedFile /home/fanning/IDL/coyote/~/IDL/coyote/fsc_surface.pro
I do notice, however, that if I use an absolute path name, rather than path name with a wildcard, that even though the Selection box is wrong, the return value has the correct path. In other words, it doesn't look right, but it acts right, if I do this.
IDL> theDirectory = '/home/fanning/IDL/coyote/' IDL> theFile = 'fsc_surface.pro' IDL> selectedFile = Dialog_Pickfile(FILE=theFile, PATH=theDirectory)
ANSWER: Yes, this is a bug. One way to work around this problem is to write code like this.
IDL> theDirectory = '~/IDL/coyote/' IDL> theFile = 'fsc_surface.pro' IDL> CD, theDirectory, CURRENT=currentDirectory IDL> selectedFile = Dialog_Pickfile(FILE=theFile, PATH=theDirectory) IDL> CD, currentDirectory
Then, the output will appear as you expect it to. See the figure below for an example.
|Dialog_Pickfile with the Selection as it is suppose to be.|
Version of IDL used to prepare this article: IDL 7.0.3.
Copyright © 2009 David W. Fanning
Last Updated 15 August 2009