Filename.st
changeset 5595 b80d12c4983b
parent 5594 3d801043be3f
child 5596 4168727b2da4
equal deleted inserted replaced
5594:3d801043be3f 5595:b80d12c4983b
  1763      'foo' asFilename removeAccessRights:#(writeUser writeGroup writeOthers).
  1763      'foo' asFilename removeAccessRights:#(writeUser writeGroup writeOthers).
  1764      'foo' asFilename removeAccessRights:#(executeUser executeGroup executeOthers).
  1764      'foo' asFilename removeAccessRights:#(executeUser executeGroup executeOthers).
  1765     "
  1765     "
  1766 
  1766 
  1767     "Modified: / 5.5.1999 / 13:41:21 / cg"
  1767     "Modified: / 5.5.1999 / 13:41:21 / cg"
       
  1768 !
       
  1769 
       
  1770 removeDirectory
       
  1771     "remove the directory.
       
  1772      Raises an exception if not successful (or if its not a directory).
       
  1773      Use #recursiveRemove in order to (recursively) remove non empty directories."
       
  1774 
       
  1775     |ok|
       
  1776 
       
  1777     ok := OperatingSystem removeDirectory:(self osNameForFile).
       
  1778     ok ifFalse:[
       
  1779         self exists ifFalse:[ ^ self].
       
  1780         self removeError:self
       
  1781     ].
       
  1782 
       
  1783     "
       
  1784      (FileStream newFileNamed:'foo') close.
       
  1785      'foo' asFilename removeDirectory   
       
  1786     "
       
  1787 
       
  1788     "
       
  1789      'foo' asFilename writeStream close.
       
  1790      'foo' asFilename removeDirectory   
       
  1791     "
       
  1792 
       
  1793     "
       
  1794      'foo' asFilename makeDirectory.
       
  1795      'foo/bar' asFilename writeStream close.
       
  1796      ('foo' asFilename remove) ifFalse:[
       
  1797         Transcript showCR:'could not remove foo'
       
  1798      ]
       
  1799     "
       
  1800 
       
  1801     "Modified: / 20.11.1997 / 17:40:22 / stefan"
       
  1802     "Modified: / 5.5.1999 / 13:41:12 / cg"
       
  1803 !
       
  1804 
       
  1805 removeFile
       
  1806     "remove the file.
       
  1807      Raises an exception if not successful (or if its not a file)."
       
  1808 
       
  1809     |ok|
       
  1810 
       
  1811     ok := OperatingSystem removeFile:(self osNameForFile).
       
  1812     ok ifFalse:[
       
  1813         self exists ifFalse:[ ^ self].
       
  1814         self removeError:self
       
  1815     ].
       
  1816 
       
  1817     "
       
  1818      (FileStream newFileNamed:'foo') close.
       
  1819      'foo' asFilename removeFile   
       
  1820     "
       
  1821 
       
  1822     "
       
  1823      'foo' asFilename makeDirectory.
       
  1824      'foo' asFilename removeFile   
       
  1825     "
  1768 !
  1826 !
  1769 
  1827 
  1770 renameOrCopyTo:newName
  1828 renameOrCopyTo:newName
  1771     "rename or copy the file - the argument must be convertable to a String.
  1829     "rename or copy the file - the argument must be convertable to a String.
  1772      Raises an exception if not successful.
  1830      Raises an exception if not successful.
  3656 ! !
  3714 ! !
  3657 
  3715 
  3658 !Filename class methodsFor:'documentation'!
  3716 !Filename class methodsFor:'documentation'!
  3659 
  3717 
  3660 version
  3718 version
  3661     ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.184 2000-09-09 14:15:45 cg Exp $'
  3719     ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.185 2000-09-09 15:30:54 cg Exp $'
  3662 ! !
  3720 ! !
  3663 Filename initialize!
  3721 Filename initialize!