You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-dev@tcl.apache.org by "David N. Welton" <da...@dedasys.com> on 2002/06/21 14:52:22 UTC

web::getfilename

How does the idea of 

proc web::getfilename {filename} {
    return [file join [file dirname [web::config script]] $filename]
}

strike you guys?  I think this could be a huge stumbling block for
people ("how do I load a ^*&^ file!?"), and having it built in would
be helpful...

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: web::getfilename

Posted by "David N. Welton" <da...@dedasys.com>.
Ronnie Brunner <ro...@netcetera.ch> writes:

> > How does the idea of 

> > proc web::getfilename {filename} {
> >     return [file join [file dirname [web::config script]] $filename]
> > }

> > strike you guys?  I think this could be a huge stumbling block for
> > people ("how do I load a ^*&^ file!?"), and having it built in would
> > be helpful...

> I don't really see what you get with this. (What do you mean by
> "load a file"?) The rpoble is that it might be confused with an
> accessor to the path in the file system from a "URL" on the server:
> e.g. something like from "/index.html" to
> "/my/path/to/docs/index.html", but that's not what it's about (in
> this case it would actually return /index.x.html).

> If you really talk about loading such as [load $file] or [source
> $file], I don't think that people need much help: they either use
> absolute paths or they know how to deal with [web::config script] or
> similar.

> But I might be missing the point ...

I think part of the point is that absolute paths suck - they make it
hard to move your code to another site.  For example, the
tcl.apache.org site itself has to run both locally, so that I (we) can
test it out, as well as on the main box.  It currently does this
without much trouble at all.

[web::config script] is ok, but my thought was to provide something
that's easier, instead of doing the [file ....] routine above every
time.

The thing that worries me is that people are going to come to us in
droves asking "how do I access files relatively?".  I see this bit of
code as an easy answer.  I don't care about the name... just something
simple.

Back to packing my stuff,
-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: web::getfilename

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> How does the idea of 
> 
> proc web::getfilename {filename} {
>     return [file join [file dirname [web::config script]] $filename]
> }
> 
> strike you guys?  I think this could be a huge stumbling block for
> people ("how do I load a ^*&^ file!?"), and having it built in would
> be helpful...


I don't really see what you get with this. (What do you mean by "load
a file"?) The rpoble is that it might be confused with an accessor to
the path in the file system from a "URL" on the server: e.g. something
like from "/index.html" to "/my/path/to/docs/index.html", but that's
not what it's about (in this case it would actually return
/index.x.html).

If you really talk about loading such as [load $file] or 
[source $file], I don't think that people need much help: they either
use absolute paths or they know how to deal with [web::config script]
or similar.

But I might be missing the point ...

Ronnie
------------------------------------------------------------------------
Ronnie Brunner                               ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich     phone +41 1 247 79 79 fax +41 1 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org