#9 tk_getOpenFile on WNT does not see VFS

v1.0 (example)
closed-rejected
Jeffrey Hobbs
5
2003-01-07
2002-12-18
Gerald W. Lester
No

Under the Windows family of OSes (and I suspect Macs) tk_getOpenFile, tk_getSaveFile and
tk_chooseDirectory do not see VFS directories and files.

Example:

#!/bin/sh
# the next line restarts using wish \ exec wish "$0" "$@"

package require vfs

##
## Mount your favoriate directory as /test
##
...

##
## Test should be seen as the initial directory
##
set file [tk_getOpenFile -initialdir {/test}]

Discussion

  • Vince Darley
    Vince Darley
    2003-01-06

    Logged In: YES
    user_id=32170

    This is of course true, but is not a bug in tclvfs, or in
    Tcl. It could be considered a bug/shortcoming of Tk that it
    is not sufficiently Tcl aware to have an appropriate
    behaviour w.r.t. virtual filesystems --- please consider
    filing a bug against Tk (I would recommend doing so, but it
    might be helpful to have an idea of what behaviour you would
    like to see, and what is actually possible given the use of
    native dialogs on those Win-Mac platforms).

     
  • Vince Darley
    Vince Darley
    2003-01-06

    • status: open --> closed-rejected
     
  • Logged In: YES
    user_id=121110

    Mr. Hobbs, the Tcl/Tk maintainer suggested that I should file the bug here.

     
  • Vince Darley
    Vince Darley
    2003-01-07

    • assigned_to: nobody --> hobbs
     
  • Vince Darley
    Vince Darley
    2003-01-07

    Logged In: YES
    user_id=32170

    The problem is that there is absolutely nothing in the code
    here which can do anything about this problem. Unless Jeff
    is somehow suggesting that this package should override
    tk_get(Open|Save)(File|Directory)?

    Even that wouldn't work however, since those commands only
    exist if Tk is present, and this package doesn't depend on
    Tk at all, so the sequence:

    >tclsh
    package require vfs
    package require Tk

    would fail to over-ride anything, even if it was made Tk aware.

    So, I still suggest it is a Tk issue/bug/feature-request
    that Tk is not "up to date with the latest possibilities
    that Tcl offers".

    As far as solutions go, perhaps Tk on Win/Mac should create
    commands tk::dialog::nativeFileOpen,
    tk::dialog::nativeFileSave, tk::dialog::nativeChooseDir
    instead of the tk_* commands, and then this code in tk.tcl
    should be adjusted:

    if {[string equal [info commands tk_getOpenFile] ""]} {
    proc ::tk_getOpenFile {args} {
    if {$::tk_strictMotif} {
    return [eval tk::MotifFDialog open $args]
    } else {
    return [eval ::tk::dialog::file:: open $args]
    }
    }
    }

    to read something like:

    if {[string equal [info commands tk_getOpenFile] ""]} {
    proc ::tk_getOpenFile {args} {
    if {$::tk_strictMotif} {
    return [eval tk::MotifFDialog open $args]
    } elseif {check if -default arguments are inside a vfs
    using 'file system'} {
    return [eval ::tk::dialog::file:: open $args]
    } else {
    return [eval ::tk::dialog::nativeFileOpen $args]
    }
    }
    }

    and similarly for the other commands.