Re: Setting Intial Directory



On 2 Aug 2005 09:03:29 -0700, "Mustur" <mustur_sreenivas@xxxxxxxxx>
wrote:

>Hi all, i am novoice in Perl/Tk. I need to set up intial directory in
>the given path.. i dont know the syntax in unix. please guide me.
>sub browse
>{
> $load_file = $main -> getOpenFile
> (
> "-filetypes" => [ ["CSV files", '.csv'], ["All files", '.*'] ],
> "-title" => "read CSV file " ,
> "-initialdir" =>
>'W:\si_cs$\Technical\Ecu-vdc\SW\BaseSiS_ABK_GA\IDC-Result',
> );
># }

>From your question, I'm taking it you want to know how to enter a path
in linux(unix)?

Assuming you are in the directory that contains the subdir IDC-Result:
-initialdir => 'IDC-Result'

But I don't use this too often and I ran into a "glitch" maybe someone
else can explain? It seems I can only specify upward paths relative to
the current directory? So maybe you will need to chdir to the directory
you want as default?

#!/usr/bin/perl
use Tk;
use strict;

my $mw = MainWindow->new;

my $file_r = &fileDialog;
print"\n selected this file $file_r";
MainLoop;

sub fileDialog {
my @types =( ["Allowed photos", [qw/.jpg .png .gif/]], );

#must specify path relative to current working directory
#very clunky
my $initialdir = '../../';

#dosn't work for some reason
#my $initialdir = '/home/zentara';

my $file = $mw->getOpenFile(
-filetypes => \@types ,
-initialdir => $initialdir,
);

return($file);
}

__END__



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
.