# HG changeset patch # User Claus Gittinger # Date 901988696 -7200 # Node ID 27a62fa7b5bbc09191061b28abb8823aa0eb18a0 # Parent a80825dc682b46079c26f1be44c5a28665962656 in #isVolumeAbsolute: care for filenames of the form: \hostname diff -r a80825dc682b -r 27a62fa7b5bb PCFilename.st --- a/PCFilename.st Fri Jul 31 22:21:09 1998 +0200 +++ b/PCFilename.st Sat Aug 01 18:24:56 1998 +0200 @@ -10,17 +10,15 @@ hereby transferred. " -'From Smalltalk/X, Version:3.4.7 on 1-aug-1998 at 09:51:13' ! - Filename subclass:#PCFilename instanceVariableNames:'' classVariableNames:'StandardSuffixTable' poolDictionaries:'' - category:'OS-Windows' -! - -!PCFilename class methodsFor:'documentation'! - + category:'OS-Windows' +! + +!PCFilename class methodsFor:'documentation'! + copyright " COPYRIGHT (c) 1997 by eXept Software AG @@ -33,16 +31,16 @@ other person. No title to or ownership of the software is hereby transferred. " -! - +! + documentation " Filenames in Windows-NT / Win95. " -! ! - -!PCFilename class methodsFor:'initialization'! - +! ! + +!PCFilename class methodsFor:'initialization'! + initStandardSuffixTable "since there is no 'file' command to extract the type, return a guess based upon the files suffix. The following @@ -75,10 +73,10 @@ " "Modified: 16.10.1997 / 13:12:39 / cg" -! ! - -!PCFilename class methodsFor:'instance creation'! - +! ! + +!PCFilename class methodsFor:'instance creation'! + newTemporaryIn:aDirectoryPrefix "return a new unique filename - use this for temporary files. redefined to always return an MSDOS 8+3 fileName, @@ -138,10 +136,10 @@ "Created: 30.1.1998 / 11:49:33 / md" "Modified: 30.1.1998 / 11:52:06 / md" "Modified: 30.1.1998 / 12:09:18 / dq" -! ! - -!PCFilename class methodsFor:'queries'! - +! ! + +!PCFilename class methodsFor:'queries'! + isBadCharacter:aCharacter "return true, if aCharacter is unallowed in a filename." @@ -149,14 +147,14 @@ ^ super isBadCharacter:aCharacter "Created: 8.9.1997 / 00:14:06 / cg" -! - +! + isCaseSensitive "return true, if filenames are case sensitive." ^ false -! - +! + separator "return the file/directory separator." @@ -167,8 +165,8 @@ " "Modified: 8.9.1997 / 00:18:03 / cg" -! - +! + tempFileNameTemplate "return a template for temporary files. This is expanded with the current processID and a sequenceNumber @@ -178,10 +176,10 @@ ^ 'st%1%2.tmp' "Created: 30.1.1998 / 12:09:18 / dq" -! ! - -!PCFilename methodsFor:'file operations'! - +! ! + +!PCFilename methodsFor:'file operations'! + renameTo:newName "rename the file - the argument must be convertable to a String. Raise an error if not successful. @@ -198,10 +196,10 @@ " "Modified: 20.1.1998 / 15:33:00 / md" -! ! - -!PCFilename methodsFor:'queries'! - +! ! + +!PCFilename methodsFor:'queries'! + fileType "this returns a string describing the type of contents of the file. Here, the suffix is examined for a standard @@ -223,8 +221,8 @@ "Created: 16.10.1997 / 13:07:24 / cg" "Modified: 16.10.1997 / 13:10:00 / cg" -! - +! + isExecutableProgram "return true, if such a file exists and is an executable program. (i.e. for directories, false is returned.)" @@ -236,8 +234,8 @@ ^ false "Created: 16.10.1997 / 13:19:10 / cg" -! - +! + isExplicitRelative "return true, if this name is an explicit relative name (i.e. starts with './' or '../', to avoid path-prepending)" @@ -249,17 +247,30 @@ ^ true ]. ^ false -! - +! + isVolumeAbsolute "return true, if the receiver represents an absolute pathname on some disk volume." - ^ (((nameString size >= 3) and:[(nameString at:2) == $:]) and:[(nameString at:3) == $\]) + (((nameString size >= 3) + and:[(nameString at:2) == $:]) + and:[(nameString at:3) == $\]) ifTrue:[ + "/ something like x:\foo + ^ true + ]. + (((nameString size >= 3) + and:[(nameString at:1) == $\]) + and:[(nameString at:2) == $\]) ifTrue:[ + "/ something like \\hostname + ^ true + ]. + ^ false - "Created: 7.9.1997 / 23:54:20 / cg" -! - + "Created: / 7.9.1997 / 23:54:20 / cg" + "Modified: / 1.8.1998 / 18:24:14 / cg" +! + localNameStringFrom:aString "ST-80 compatibility. what does this do ? (used in FileNavigator-goody). @@ -275,8 +286,8 @@ ^ aString copyFrom:1 ]. ^ aString -! - +! + volume "return the disc volume part of the name or an empty string. This is only used with DOS filenames - on unix, an empty string is returned" @@ -287,10 +298,10 @@ ^ '' "Created: 7.9.1997 / 23:58:06 / cg" -! ! - -!PCFilename methodsFor:'special accessing'! - +! ! + +!PCFilename methodsFor:'special accessing'! + osNameForDirectory "special - return the OS's name for the receiver to access it as a directory. @@ -304,18 +315,18 @@ ^ nameString "Modified: 20.1.1998 / 15:39:06 / md" -! - +! + setName:aString "set the filename" nameString := aString copy replaceAll:$/ with:$\ "Created: 22.1.1998 / 17:32:45 / md" -! ! - -!PCFilename class methodsFor:'documentation'! - +! ! + +!PCFilename class methodsFor:'documentation'! + version - ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.9 1998-06-15 13:39:10 cg Exp $' -! ! + ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.10 1998-08-01 16:24:56 cg Exp $' +! !