# VisualuRuby openFilename starting directory

**URL:** <https://rubytalk.org/t/visualuruby-openfilename-starting-directory/6185>\
**Category:** ruby-talk\
**Created:** [30 May 2003 11:41 UTC](https://rubytalk.org/t/visualuruby-openfilename-starting-directory/6185 "2003-05-30T11:41:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Johnson](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@John\_Johnson](https://rubytalk.org/u/John_Johnson)\
**Post date:** [30 May 2003 11:41 UTC](https://rubytalk.org/t/visualuruby-openfilename-starting-directory/6185/1 "2003-05-30T11:41:09Z")

</div>

Hi,

Is there a way to set the directory for a Swin::CommonDialog.openFilename()  
call? For example, I might want to set the directory to the last directory  
a person used, using a value I saved.

I’m looking at the swin source, and don’t see anything obvious.

Thanks,  
JJ

---

<div class="post-metadata">

**Author:** ![daz](https://avatars.discourse-cdn.com/v4/letter/d/87869e/32.png) [@daz](https://rubytalk.org/u/daz)\
**Post date:** [31 May 2003 07:36 UTC](https://rubytalk.org/t/visualuruby-openfilename-starting-directory/6185/2 "2003-05-31T07:36:20Z")

</div>

Last I looked, it was not implemented.

You can do -

Dir.chdir(‘D:\somedir\orother’)

before the call to Swin::CommonDialog.openFilename()  
if it’s not too disruptive.

Also, there’s

cwd = Dir.getwd  
Dir.chdir(‘D:\somedir\orother’)  
(-call to Swin-)  
Dir.chdir(cwd)

if you need to preserve the current working directory  
over the call (although I never know what it’s set to).

daz

> **···**
>
> “John Johnson” [jj5412@earthlink.net](mailto:jj5412@earthlink.net) wrote:
> 
> > Hi,
> > 
> > Is there a way to set the directory for a Swin::CommonDialog.openFilename()  
> > call? For example, I might want to set the directory to the last directory  
> > a person used, using a value I saved.
> > 
> > I’m looking at the swin source, and don’t see anything obvious.
> > 
> > Thanks,  
> > JJ
