- Subject: proposal 'file string functions'
- From: "ks" <klaus.schmid@xxxxxx>
- Date: Sat, 30 Mar 2002 13:43:00 +0100
Model/Terminology:
File == Path + Base
Path=="" and Base=="" should be legal.
This way a path or a base string can
be handed over, wherever a file string
is expected. A file may point to an
existant or non-existant ordinary file
or directory. Existancy, type, shortcut
and profound syntax checking is not
covered by these file string functions.
For example type and existancy checking
can be done with the present jed-function
file_status. The proposed set of functions
may replace the slang-functions path_*.
Elementary functions:
Path= file_path( File)
Base= file_base( File)
Ext= file_ext( File)
S= file_sans_ext( File)
Overloaded functions:
Get path n levels higher and down to B1, B2, ... BM
Path= file_path( File, n, B1, B2, ... BM)
Get base n levels higher
Base= file_base( File, n)
Examples:
file_path( "d:[a.b]jedini.sl") --> "d:[a.b]" on vms
file_path( "c:\a\b\jedini.sl") --> "c:\a\b\" on dos
file_path( "/a/b/jedini.sl") --> "/a/b/" on unix
file_base( "/a/b/jedini.sl") --> "jedini.sl"
file_ext( "/a/b/jedini.sl") --> ".sl"
file_sans_ext( "/a/b/jedini.sl") --> "/a/b/jedini"
file_path( "/a/b/jedini.sl", 1, "c", "d")
or file_path( "/a/b/", 1, "c", "d") --> "/a/c/d/"
file_base( "/a/b/jedini.sl", 2)
or file_base( "/a/b/", 2) --> "a"
file_path( "/a/b/jedini.sl")+"c.sl" --> "/a/b/c.sl"
I think these functions would be easier to read,
remind and use. What do you think?
Klaus
[2002 date index]
[2002 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]