FileOperation.st
changeset 5790 a20cb6fcb74b
parent 5788 c42526d05d57
child 5805 90a121efe94f
equal deleted inserted replaced
5789:b357cb31cc87 5790:a20cb6fcb74b
   200 ! !
   200 ! !
   201 
   201 
   202 !FileOperation::Copy class methodsFor:'documentation'!
   202 !FileOperation::Copy class methodsFor:'documentation'!
   203 
   203 
   204 version
   204 version
   205     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.45 2004-03-22 19:33:54 cg Exp $'
   205     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.46 2004-03-22 22:01:08 cg Exp $'
   206 ! !
   206 ! !
   207 
   207 
   208 !FileOperation::Copy methodsFor:'accessing'!
   208 !FileOperation::Copy methodsFor:'accessing'!
   209 
   209 
   210 colOfCopiedFiles
   210 colOfCopiedFiles
   407 ! !
   407 ! !
   408 
   408 
   409 !FileOperation::Create class methodsFor:'documentation'!
   409 !FileOperation::Create class methodsFor:'documentation'!
   410 
   410 
   411 version
   411 version
   412     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.45 2004-03-22 19:33:54 cg Exp $'
   412     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.46 2004-03-22 22:01:08 cg Exp $'
   413 ! !
   413 ! !
   414 
   414 
   415 !FileOperation::Create methodsFor:'accessing'!
   415 !FileOperation::Create methodsFor:'accessing'!
   416 
   416 
   417 createdFile
   417 createdFile
   680 ! !
   680 ! !
   681 
   681 
   682 !FileOperation::Delete class methodsFor:'documentation'!
   682 !FileOperation::Delete class methodsFor:'documentation'!
   683 
   683 
   684 version
   684 version
   685     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.45 2004-03-22 19:33:54 cg Exp $'
   685     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.46 2004-03-22 22:01:08 cg Exp $'
   686 ! !
   686 ! !
   687 
   687 
   688 !FileOperation::Delete methodsFor:'actions'!
   688 !FileOperation::Delete methodsFor:'actions'!
   689 
   689 
   690 deleteFile:aFileOrDirectory
   690 deleteFile:aFileOrDirectory
   874 ! !
   874 ! !
   875 
   875 
   876 !FileOperation::Move class methodsFor:'documentation'!
   876 !FileOperation::Move class methodsFor:'documentation'!
   877 
   877 
   878 version
   878 version
   879     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.45 2004-03-22 19:33:54 cg Exp $'
   879     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.46 2004-03-22 22:01:08 cg Exp $'
   880 ! !
   880 ! !
   881 
   881 
   882 !FileOperation::Move methodsFor:'accessing'!
   882 !FileOperation::Move methodsFor:'accessing'!
   883 
   883 
   884 colOfMovedFiles
   884 colOfMovedFiles
   962     ^ self moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:true
   962     ^ self moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:true
   963 !
   963 !
   964 
   964 
   965 moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:move
   965 moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:move
   966 
   966 
   967     |newFile suffix fileString askResult|
   967     |newFile suffix fileString doMove|
   968 
   968 
   969     (aDirectory exists) ifFalse:[
   969     (aDirectory exists) ifFalse:[
   970         Dialog warn:('Cannot move to non-existing directory %1.' bindWith:aDirectory asString allBold).
   970         Dialog warn:('Cannot move to non-existing directory %1.' bindWith:aDirectory asString allBold).
   971         result := false.
   971         result := false.
   972         ^ self
   972         ^ self
   976         result := false.
   976         result := false.
   977         ^ self
   977         ^ self
   978     ].
   978     ].
   979     aColOfSourceFiles do:[: filename |
   979     aColOfSourceFiles do:[: filename |
   980         newFile := aDirectory construct:filename baseName.
   980         newFile := aDirectory construct:filename baseName.
       
   981 
       
   982         doMove := true.
   981         (newFile exists) ifTrue:[
   983         (newFile exists) ifTrue:[
   982             askResult := true.
       
   983             ((newFile asString = filename asString) and:[move]) ifTrue:[
   984             ((newFile asString = filename asString) and:[move]) ifTrue:[
   984                 [newFile exists] whileTrue:[
   985                 [newFile exists] whileTrue:[
   985                     suffix := newFile suffix.
   986                     suffix := newFile suffix.
   986                     fileString := newFile baseName withoutSuffix, self class copyMoveIfExistSuffixString, '.', suffix.
   987                     fileString := newFile baseName withoutSuffix, self class copyMoveIfExistSuffixString, '.', suffix.
   987                     newFile := aDirectory construct:fileString.
   988                     newFile := aDirectory construct:fileString.
   988                 ].
   989                 ].
   989             ] ifFalse:[
   990             ] ifFalse:[
   990                 overWriteWarning ifTrue:[
   991                 overWriteWarning ifTrue:[
   991                     askResult := self fileExistDialogForNewFile:newFile oldFile:filename withCancel:(aColOfSourceFiles size > 1).
   992                     doMove := self fileExistDialogForNewFile:newFile oldFile:filename withCancel:(aColOfSourceFiles size > 1).
   992                     askResult isNil ifTrue:[
   993                     doMove isNil ifTrue:[
   993                         result := false.
   994                         result := false.
   994                         ^ self.
   995                         ^ self.
   995                     ]
   996                     ]
   996                 ]
   997                 ]
   997             ].
   998             ].
   998         ].
   999         ].
   999 
  1000 
  1000         askResult ifTrue:[
  1001         doMove ifTrue:[
  1001             Error handle:[:ex|
  1002             Error handle:[:ex|
  1002                 "was not able to copy it"
  1003                 "was not able to copy it"
  1003                 result := false.
  1004                 result := false.
  1004                 self errorString:(' Error in Move-File Operation:', ex description asString).
  1005                 self errorString:(' Error in Move-File Operation:', ex description asString).
  1005                 ( Dialog 
  1006                 ( Dialog 
  1044 ! !
  1045 ! !
  1045 
  1046 
  1046 !FileOperation::Rename class methodsFor:'documentation'!
  1047 !FileOperation::Rename class methodsFor:'documentation'!
  1047 
  1048 
  1048 version
  1049 version
  1049     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.45 2004-03-22 19:33:54 cg Exp $'
  1050     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.46 2004-03-22 22:01:08 cg Exp $'
  1050 ! !
  1051 ! !
  1051 
  1052 
  1052 !FileOperation::Rename methodsFor:'accessing'!
  1053 !FileOperation::Rename methodsFor:'accessing'!
  1053 
  1054 
  1054 renamedFiles
  1055 renamedFiles
  1150 ! !
  1151 ! !
  1151 
  1152 
  1152 !FileOperation class methodsFor:'documentation'!
  1153 !FileOperation class methodsFor:'documentation'!
  1153 
  1154 
  1154 version
  1155 version
  1155     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.45 2004-03-22 19:33:54 cg Exp $'
  1156     ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.46 2004-03-22 22:01:08 cg Exp $'
  1156 ! !
  1157 ! !