|
Class: UnixFilename
Object
|
+--Filename
|
+--UnixFilename
- Package:
- stx:libbasic
- Category:
- OS-Unix
- Version:
- rev:
1.39
date: 2024/03/22 10:27:38
- user: stefan
- file: UnixFilename.st directory: libbasic
- module: stx stc-classLibrary: libbasic
Filenames in Unix.
copyrightCOPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
class initialization
-
initialize
-
Unix flavors of ST/X do not include the PCFilename class.
When a PCFilename is stored in a literalArray under windows,
it references the PCFilename class via a Symbol.
In order to be able to read these literal arrays under Unix,
we define PCFilename as an alias here.
Consider this a kludge.
A better (but not backward compatible) solution is in:
Filename >> literalArrayEncoding and
Filename class >> #decodeFromLiteralArray:
Note: Windows does contain the UnixFilename class.
defaults
-
defaultTempDirectoryName
-
return the default temp directory as a filename.
By default, this is '/tmp', but can be overriden by one of
the shell variables: ('STX_TMPDIR' 'ST_TMPDIR' 'TMPDIR' 'TEMPDIR' 'TEMP' 'TMP')
Usage example(s):
Filename defaultTempDirectoryName
Filename defaultTempDirectoryName exists
Filename defaultTempDirectoryName isWritable
|
misc
-
nameWithSpecialExpansions: aString
-
return the nameString, expanding any OS specific macros.
Here, a ~/ or ~user/ prefix is expanded to the user's home dir (as in csh, bash)
Usage example(s):
self nameWithSpecialExpansions:'/usr/lib'
self nameWithSpecialExpansions:'$JAVA_HOME/bin'
self nameWithSpecialExpansions:'${JAVA_HOME}/bin'
self nameWithSpecialExpansions:'${JAVA_HOME}-tttttt'
self nameWithSpecialExpansions:'$(JAVA_HOME)/bin'
self nameWithSpecialExpansions:'$(JAVA_HOME)bin'
self nameWithSpecialExpansions:'~/work'
self nameWithSpecialExpansions:'~stefan/test'
self nameWithSpecialExpansions:'/Users/exept/cg_work/exept/expecco/application/expecco_dmg/Applications'
|
queries
-
isBadCharacter: aCharacter
-
return true, if aCharacter is unallowed in a filename.
-
isCaseSensitive
-
return true, if filenames are case sensitive.
This is not really correct, as the sensitivity may depend on
the paricular mounted file system (NFS, for example)
-
nullFilename
-
Return /dev/null
Usage example(s):
-
parentDirectoryName
-
return the name used for the parent directory.
This is '..' for unix and dos-like systems.
(there may be more in the future.
-
separator
-
return the file/directory separator.
Usage example(s):
Filename concreteClass separator
|
-
separatorString
-
return the file/directory separator as a string.
Usage example(s):
conversion
-
asUnixFilename
-
file queries
-
fileType
-
this returns a string describing the type of contents of the file.
This is done using the unix 'file' command,
(which usually is configurable by /etc/magic).
Warning:
Since the returned string differs among systems (and language settings),
it is only useful for user-information;
NOT as a tag to be used by a program.
For this, use mimeType or mimeTypeOfContents.
Usage example(s):
ones are checked first, using the general fileType implementation.
|
Usage example(s):
'Makefile' asFilename fileType
'.' asFilename fileType
'/dev/null' asFilename fileType
'smalltalk.rc' asFilename fileType
'bitmaps/SBrowser.xbm' asFilename fileType
'../../libtool/bitmaps/SBrowser.xbm' asFilename fileType
'./stx' asFilename fileType
|
queries
-
isExplicitRelative
-
return true, if this name is an explicit relative name
(i.e. starts with './' or '../', to avoid path-prepending)
-
isHidden
-
return true, if the receiver represents a hidden file.
On UNIX, a name starting with a period is considered hidden.
-
isImplicit
-
return true, if the receiver represents builtin names such as '.' or '..'.
On UNIX, the current and parent dir names are considered implicit.
special accessing
-
osName
-
redefined from superclass, because we do not distinguish file and directory names
-
osNameForFile
-
internal - return the OS's name for the receiver to
access it as a file.
(self named:'/tmp/äöü') writeStream close
|