Filename.st
changeset 1970 fd136beb8385
parent 1969 82192c7170bc
child 1993 a099e396ab6d
equal deleted inserted replaced
1969:82192c7170bc 1970:fd136beb8385
   670 
   670 
   671     ^ self pathName asFilename
   671     ^ self pathName asFilename
   672 !
   672 !
   673 
   673 
   674 asFilename
   674 asFilename
   675     "return the receiver converted to a filename."
   675     "return the receiver converted to a filename; here, thats the receiver itself."
   676 
   676 
   677     "Thats pretty easy here :-)"
   677     "Thats pretty easy here :-)"
   678     ^ self
   678     ^ self
       
   679 
       
   680     "Modified: 12.11.1996 / 12:40:03 / cg"
   679 !
   681 !
   680 
   682 
   681 asString
   683 asString
   682     "return the receiver converted to a string"
   684     "return the receiver converted to a string"
   683 
   685 
   684     ^ nameString
   686     ^ nameString
   685 !
   687 !
   686 
   688 
   687 makeLegalFilename 
   689 makeLegalFilename 
   688     "convert the receveivers name to be a legal filename.
   690     "convert the receivers name to be a legal filename.
       
   691      This removes/replaces invalid characters and/or compresses
       
   692      the name as required by the OS.
   689      The implementation may change in the future to be more
   693      The implementation may change in the future to be more
   690      OS specific."
   694      OS specific."
   691 
   695 
   692     "
   696     "
   693      actually, in Unix spaces are allowed - but it makes life
   697      actually, in Unix spaces are allowed - but it makes life
   701     ^ self
   705     ^ self
   702 
   706 
   703     "
   707     "
   704      'hello world' asFilename makeLegalFilename 
   708      'hello world' asFilename makeLegalFilename 
   705     "
   709     "
       
   710 
       
   711     "Modified: 12.11.1996 / 12:39:04 / cg"
   706 ! !
   712 ! !
   707 
   713 
   708 !Filename methodsFor:'error handling'!
   714 !Filename methodsFor:'error handling'!
   709 
   715 
   710 accessDeniedError:filename
   716 accessDeniedError:filename
   869 makeDirectory
   875 makeDirectory
   870     "create a directory with the receivers name.
   876     "create a directory with the receivers name.
   871      Return true if successful, false if not."
   877      Return true if successful, false if not."
   872 
   878 
   873     (OperatingSystem createDirectory:nameString) ifFalse:[
   879     (OperatingSystem createDirectory:nameString) ifFalse:[
   874 	^ self fileCreationError:self
   880         (self exists and:[self isDirectory]) ifFalse:[
       
   881             ^ self fileCreationError:self
       
   882         ]
   875     ]
   883     ]
       
   884 
       
   885     "Modified: 12.11.1996 / 12:25:22 / cg"
   876 !
   886 !
   877 
   887 
   878 makeExecutable
   888 makeExecutable
   879     "make the file executable - you must have permission to do so.
   889     "make the file executable - you must have permission to do so.
   880      For directories, execution means: 'allow changing into it'"
   890      For directories, execution means: 'allow changing into it'"
  2054 ! !
  2064 ! !
  2055 
  2065 
  2056 !Filename class methodsFor:'documentation'!
  2066 !Filename class methodsFor:'documentation'!
  2057 
  2067 
  2058 version
  2068 version
  2059     ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.73 1996-11-12 11:23:32 cg Exp $'
  2069     ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.74 1996-11-12 11:43:40 cg Exp $'
  2060 ! !
  2070 ! !