author | Claus Gittinger <cg@exept.de> |
Thu, 14 Apr 2005 11:13:31 +0200 | |
changeset 6250 | 5b0673ccff1c |
parent 6185 | d366b36841fd |
child 6285 | fc86d75c6e29 |
permissions | -rw-r--r-- |
6168 | 1 |
" |
2 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
3841 | 13 |
"{ Package: 'stx:libtool2' }" |
14 |
||
15 |
Object subclass:#FileOperation |
|
3975
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
16 |
instanceVariableNames:'errorString result' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
17 |
classVariableNames:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
18 |
poolDictionaries:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
19 |
category:'Interface-Support' |
3841 | 20 |
! |
21 |
||
3842 | 22 |
FileOperation subclass:#Copy |
3975
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
23 |
instanceVariableNames:'colOfCopiedFiles' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
24 |
classVariableNames:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
25 |
poolDictionaries:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
26 |
privateIn:FileOperation |
3842 | 27 |
! |
28 |
||
29 |
FileOperation subclass:#Create |
|
3975
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
30 |
instanceVariableNames:'createdFile' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
31 |
classVariableNames:'LastCreatedDirectory LastCreatedFile' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
32 |
poolDictionaries:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
33 |
privateIn:FileOperation |
3842 | 34 |
! |
35 |
||
36 |
FileOperation subclass:#Delete |
|
3975
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
37 |
instanceVariableNames:'fileName' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
38 |
classVariableNames:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
39 |
poolDictionaries:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
40 |
privateIn:FileOperation |
3842 | 41 |
! |
42 |
||
6168 | 43 |
FileOperation::Delete subclass:#Erase |
44 |
instanceVariableNames:'' |
|
45 |
classVariableNames:'' |
|
46 |
poolDictionaries:'' |
|
47 |
privateIn:FileOperation |
|
48 |
! |
|
49 |
||
3842 | 50 |
FileOperation subclass:#Move |
3975
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
51 |
instanceVariableNames:'colOfMovedFiles' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
52 |
classVariableNames:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
53 |
poolDictionaries:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
54 |
privateIn:FileOperation |
3842 | 55 |
! |
56 |
||
57 |
FileOperation subclass:#Rename |
|
3975
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
58 |
instanceVariableNames:'renamedFiles' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
59 |
classVariableNames:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
60 |
poolDictionaries:'' |
dcaac82381dc
share goodRenameDefault code with FileBrowser
Claus Gittinger <cg@exept.de>
parents:
3877
diff
changeset
|
61 |
privateIn:FileOperation |
3842 | 62 |
! |
63 |
||
6168 | 64 |
!FileOperation class methodsFor:'documentation'! |
65 |
||
66 |
copyright |
|
67 |
" |
|
68 |
COPYRIGHT (c) 2003 by eXept Software AG |
|
69 |
All Rights Reserved |
|
70 |
||
71 |
This software is furnished under a license and may be used |
|
72 |
only in accordance with the terms of that license and with the |
|
73 |
inclusion of the above copyright notice. This software may not |
|
74 |
be provided or otherwise made available to, or used by, any |
|
75 |
other person. No title to or ownership of the software is |
|
76 |
hereby transferred. |
|
77 |
" |
|
78 |
! ! |
|
3841 | 79 |
|
5961 | 80 |
!FileOperation class methodsFor:'actions'! |
81 |
||
82 |
copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarningBoolean copyFileIfSame:copyIfSameBoolean |
|
83 |
^ Copy |
|
84 |
copyFile:aSourceFile to:aDestFile |
|
85 |
withOverWriteWarning:overWriteWarningBoolean |
|
86 |
copyFileIfSame:copyIfSameBoolean |
|
87 |
! |
|
88 |
||
89 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
90 |
^ Copy copyFiles:aColOfSourceFiles to:aDirectory |
|
91 |
! |
|
92 |
||
93 |
createDirectoryIn:aDirectory |
|
94 |
^ Create createDirectoryIn:aDirectory |
|
95 |
! |
|
96 |
||
97 |
createDirectoryIn:aDirectory initialAnswer:defaultAnswer |
|
98 |
^ Create createDirectoryIn:aDirectory initialAnswer:defaultAnswer |
|
99 |
! |
|
100 |
||
101 |
createFileIn:aDirectory |
|
102 |
^ Create createFileIn:aDirectory |
|
103 |
! |
|
104 |
||
105 |
createHardLinkIn:dir |
|
106 |
^ Create createHardLinkIn:dir |
|
107 |
! |
|
108 |
||
6151 | 109 |
createLinkIn:dir soft:soft |
110 |
^ Create createLinkIn:dir soft:soft |
|
111 |
! |
|
112 |
||
5961 | 113 |
createSoftLinkIn:dir |
114 |
^ Create createSoftLinkIn:dir |
|
115 |
! |
|
116 |
||
117 |
deleteFiles:colOfFiles confirm:confirm |
|
118 |
^ Delete deleteFiles:colOfFiles confirm:confirm |
|
119 |
! |
|
120 |
||
6168 | 121 |
eraseFiles:colOfFiles confirm:confirm |
122 |
^ Erase deleteFiles:colOfFiles confirm:confirm |
|
123 |
! |
|
124 |
||
5961 | 125 |
moveFile:aSourceFile to:aDestFile |
6168 | 126 |
^ Move moveFile:aSourceFile to:aDestFile |
5961 | 127 |
! |
128 |
||
129 |
moveFiles:aCollectionOfFiles to:aDestDirectory |
|
6168 | 130 |
^ Move moveFiles:aCollectionOfFiles to:aDestDirectory |
5961 | 131 |
! |
132 |
||
133 |
renameFile:filename to:newFileString |
|
6168 | 134 |
^ Rename renameFile:filename to:newFileString |
5961 | 135 |
! |
136 |
||
137 |
renameFiles:aCollectionofFilenames |
|
6168 | 138 |
^ Rename renameFiles:aCollectionofFilenames |
5961 | 139 |
! ! |
140 |
||
3841 | 141 |
!FileOperation class methodsFor:'defaults'! |
142 |
||
6168 | 143 |
suffixForCopyOverExistingFile |
3841 | 144 |
^ '.copy' |
145 |
! ! |
|
146 |
||
147 |
!FileOperation methodsFor:'accessing'! |
|
148 |
||
149 |
errorString |
|
150 |
^ errorString |
|
151 |
! |
|
152 |
||
153 |
errorString:something |
|
154 |
errorString := something. |
|
155 |
! |
|
156 |
||
157 |
result |
|
158 |
^ result |
|
159 |
! |
|
160 |
||
161 |
result:something |
|
162 |
result := something. |
|
163 |
! ! |
|
164 |
||
165 |
!FileOperation methodsFor:'dialogs'! |
|
166 |
||
6168 | 167 |
fileExistsDialogForNewFile:newFile oldFile:oldFile withCancel:withCancel |
4701 | 168 |
"return true, if the file should be moved/copied. |
169 |
Ask user if oldFile exists." |
|
170 |
||
6168 | 171 |
^ self fileExistsDialogForNewFile:newFile oldFile:oldFile withCancel:withCancel withRemoveIfSame:false. |
5862 | 172 |
! |
173 |
||
6168 | 174 |
fileExistsDialogForNewFile:newFile oldFile:oldFile withCancel:withCancel withRemoveIfSame:withRemoveIfSame |
5862 | 175 |
"return true, if the file should be moved/copied. |
176 |
If oldFile exists, ask user. |
|
177 |
If withRemoveIfSame is true, two additional possible values are returned: |
|
178 |
#removeSource and #removeDestination. |
|
179 |
" |
|
180 |
||
5888 | 181 |
|msg oldSize newSize sameContents resources sourceType destType| |
4701 | 182 |
|
183 |
newFile exists ifFalse:[ ^ true ]. |
|
184 |
oldSize := oldFile fileSize. |
|
185 |
newSize := newFile fileSize. |
|
186 |
||
5888 | 187 |
sameContents := false. |
188 |
||
189 |
newFile isDirectory ifTrue:[ |
|
190 |
oldFile isDirectory ifTrue:[ |
|
191 |
"/ could (should?) recursively look for same contents here... |
|
192 |
]. |
|
193 |
] ifFalse:[ |
|
194 |
oldFile isDirectory ifFalse:[ |
|
195 |
sameContents := oldSize = newSize and:[oldFile sameContentsAs:newFile]. |
|
196 |
] |
|
197 |
]. |
|
198 |
||
199 |
"/ for now: |
|
200 |
oldFile isDirectory ~~ newFile isDirectory ifTrue:[ |
|
201 |
Dialog warn:(resources string:'Will not overwrite directory with file and vice versa.'). |
|
202 |
^ false. |
|
203 |
]. |
|
204 |
||
205 |
sourceType := newFile isDirectory ifTrue:'directory' ifFalse:'file'. |
|
206 |
destType := oldFile isDirectory ifTrue:'directory' ifFalse:'file'. |
|
3841 | 207 |
|
4701 | 208 |
sameContents ifTrue:[ |
5888 | 209 |
msg := 'Overwrite existing destination %7:\\ %1\ size: %3 of %2\\with source (same contents):\\ %4\ size: %6 of %5'. |
4701 | 210 |
] ifFalse:[ |
5888 | 211 |
msg := 'Overwrite existing destination %7:\\ %1\ size: %3 of %2\\with source:\\ %4\ size: %6 of %5'. |
4701 | 212 |
]. |
4587 | 213 |
|
5862 | 214 |
resources := AbstractFileBrowser classResources. |
215 |
msg := resources |
|
4701 | 216 |
stringWithCRs:msg |
217 |
withArgs:(Array |
|
218 |
with:newFile asString allBold |
|
219 |
with:(newFile modificationTime printStringFormat:'%(Day)-%(mon)-%(year) %h:%m:%s') |
|
220 |
with:newSize |
|
221 |
with:oldFile asString allBold |
|
222 |
with:(oldFile modificationTime printStringFormat:'%(Day)-%(mon)-%(year) %h:%m:%s') |
|
5888 | 223 |
with:oldSize |
224 |
with:destType). |
|
4701 | 225 |
|
5862 | 226 |
(sameContents and:[withRemoveIfSame]) ifTrue:[ |
227 |
^ OptionBox |
|
228 |
request:msg |
|
229 |
label:(resources string:'Overwrite existing file') |
|
230 |
image:(YesNoBox iconBitmap) |
|
231 |
buttonLabels:(resources array:( #('No' 'Remove Source' 'Remove Destination' 'Yes' ) , (withCancel ifTrue:[#('Cancel')] ifFalse:[#()]))) |
|
232 |
values:#( false #removeSource #removeDestination true ) |
|
233 |
default:#removeSource |
|
234 |
onCancel:nil. |
|
235 |
] ifFalse:[ |
|
236 |
^ Dialog confirm:msg withCancel:withCancel. |
|
237 |
]. |
|
3841 | 238 |
! ! |
239 |
||
3842 | 240 |
!FileOperation::Copy class methodsFor:'actions'! |
241 |
||
242 |
copyFile:aSourceFile to:aDestFile |
|
243 |
|instance| |
|
244 |
||
245 |
instance := self new. |
|
246 |
instance copyFile:aSourceFile to:aDestFile. |
|
247 |
^ instance |
|
248 |
! |
|
249 |
||
250 |
copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning |
|
251 |
|instance| |
|
252 |
||
253 |
instance := self new. |
|
254 |
instance copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning. |
|
255 |
^ instance |
|
256 |
! |
|
257 |
||
5961 | 258 |
copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarningBoolean copyFileIfSame:copyIfSameBoolean |
3842 | 259 |
|instance| |
260 |
||
261 |
instance := self new. |
|
5961 | 262 |
instance copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarningBoolean copyFileIfSame:copyIfSameBoolean. |
3842 | 263 |
^ instance |
264 |
! |
|
265 |
||
266 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
267 |
|instance| |
|
268 |
||
269 |
instance := self new. |
|
270 |
instance copyFiles:aColOfSourceFiles to:aDirectory. |
|
271 |
^ instance |
|
272 |
! |
|
273 |
||
274 |
copyFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning |
|
275 |
|instance| |
|
276 |
||
277 |
instance := self new. |
|
278 |
instance copyFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning. |
|
279 |
^ instance |
|
280 |
! |
|
281 |
||
282 |
copyFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning copyFileIfSame:copy |
|
283 |
|instance| |
|
284 |
||
285 |
instance := self new. |
|
286 |
instance copyFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning copyFileIfSame:copy. |
|
287 |
^ instance |
|
288 |
! ! |
|
289 |
||
290 |
!FileOperation::Copy methodsFor:'accessing'! |
|
291 |
||
292 |
colOfCopiedFiles |
|
293 |
colOfCopiedFiles isNil ifTrue:[ |
|
294 |
colOfCopiedFiles := OrderedCollection new. |
|
295 |
]. |
|
296 |
^ colOfCopiedFiles |
|
297 |
! ! |
|
298 |
||
299 |
!FileOperation::Copy methodsFor:'actions'! |
|
300 |
||
301 |
copyFile:aSourceFile to:aDestFile |
|
302 |
self copyFile:aSourceFile to:aDestFile withOverWriteWarning:true |
|
303 |
! |
|
304 |
||
305 |
copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning |
|
306 |
self copyFile:aSourceFile to:aDestFile withOverWriteWarning:true copyFileIfSame:true |
|
307 |
! |
|
308 |
||
5961 | 309 |
copyFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarningBoolean copyFileIfSame:copyIfSameBoolean |
3842 | 310 |
|newFile fileString targetDirectory targetIsDirectory sourceIsDirectory suffix| |
311 |
||
312 |
sourceIsDirectory := aSourceFile isDirectory. |
|
313 |
targetIsDirectory := aDestFile isDirectory. |
|
314 |
targetIsDirectory ifTrue:[ |
|
315 |
targetDirectory := aDestFile. |
|
316 |
newFile := aDestFile construct:(aSourceFile baseName). |
|
317 |
] ifFalse:[ |
|
318 |
targetDirectory := aDestFile directory. |
|
319 |
newFile := aDestFile. |
|
320 |
]. |
|
321 |
"/ do not copy if destination directory doest exist. |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6185
diff
changeset
|
322 |
targetDirectory exists ifFalse:[ |
3863 | 323 |
Dialog warn:'cant copy to not existing directory ', targetDirectory asString. |
3842 | 324 |
result := false. |
325 |
^ self |
|
326 |
]. |
|
327 |
(newFile exists) ifTrue:[ |
|
5961 | 328 |
((newFile asString = aSourceFile asString) and:[copyIfSameBoolean]) ifTrue:[ |
3842 | 329 |
[newFile exists] whileTrue:[ |
330 |
suffix := newFile suffix. |
|
6168 | 331 |
fileString := newFile baseName withoutSuffix, self class suffixForCopyOverExistingFile, '.', suffix. |
3842 | 332 |
newFile := targetDirectory construct:fileString. |
333 |
]. |
|
334 |
] ifFalse:[ |
|
5961 | 335 |
overWriteWarningBoolean ifTrue:[ |
6168 | 336 |
(self fileExistsDialogForNewFile:newFile oldFile:aSourceFile withCancel:false withRemoveIfSame:false) ifFalse:[ |
3842 | 337 |
result := false. |
338 |
^ self. |
|
339 |
] |
|
340 |
] ifFalse:[ |
|
341 |
result := false. |
|
342 |
^ self. |
|
343 |
] |
|
344 |
]. |
|
345 |
]. |
|
346 |
Error handle:[:ex| |
|
347 |
"was not able to copy it" |
|
348 |
WarningBox warn:'on copy file - ', ex errorString. |
|
349 |
self errorString:('on copy file - ', ex description asString). |
|
350 |
result := false. |
|
4006
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
351 |
^ self |
3842 | 352 |
] do:[ |
353 |
sourceIsDirectory ifTrue:[ |
|
5862 | 354 |
OperatingSystem recursiveCopyDirectory:(aSourceFile pathName) to:(newFile pathName). |
3842 | 355 |
] ifFalse:[ |
356 |
aSourceFile copyTo:newFile. |
|
357 |
]. |
|
358 |
]. |
|
4006
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
359 |
DirectoryContents flushCachedDirectoryFor:(aSourceFile directory). |
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
360 |
result := true. |
3842 | 361 |
! |
362 |
||
363 |
copyFiles:aColOfSourceFiles to:aDirectory |
|
364 |
^ self copyFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:true. |
|
365 |
! |
|
366 |
||
367 |
copyFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning |
|
368 |
^ self copyFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning copyFileIfSame:true. |
|
369 |
! |
|
370 |
||
371 |
copyFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning copyFileIfSame:copy |
|
5819 | 372 |
|newFile suffix fileString sourceIsDirectory overWriteExisting| |
3842 | 373 |
|
6152 | 374 |
(aDirectory exists) ifFalse:[ |
375 |
Dialog warn:'Can''t copy to non-existing directory ', aDirectory asString. |
|
3842 | 376 |
result := false. |
377 |
^ self |
|
378 |
]. |
|
6152 | 379 |
(aDirectory isDirectory) ifFalse:[ |
380 |
Dialog warn:'Destination ', aDirectory asString, ' is not a directory'. |
|
3842 | 381 |
result := false. |
382 |
^ self |
|
383 |
]. |
|
384 |
aColOfSourceFiles do:[: filename | |
|
385 |
newFile := aDirectory construct:(filename baseName). |
|
386 |
sourceIsDirectory := filename isDirectory. |
|
5819 | 387 |
overWriteExisting := true. |
3842 | 388 |
(newFile exists) ifTrue:[ |
389 |
((newFile asString = filename asString) and:[copy]) ifTrue:[ |
|
390 |
[newFile exists] whileTrue:[ |
|
391 |
suffix := newFile suffix. |
|
6168 | 392 |
fileString := newFile withoutSuffix baseName, self class suffixForCopyOverExistingFile. |
5081 | 393 |
suffix notEmpty ifTrue:[ |
394 |
fileString := fileString, '.', suffix. |
|
395 |
]. |
|
3842 | 396 |
newFile := aDirectory construct:fileString. |
397 |
]. |
|
398 |
] ifFalse:[ |
|
399 |
overWriteWarning ifTrue:[ |
|
6168 | 400 |
overWriteExisting := (self fileExistsDialogForNewFile:newFile oldFile:filename withCancel:(aColOfSourceFiles size > 1) withRemoveIfSame:false). |
5819 | 401 |
overWriteExisting isNil ifTrue:[ |
402 |
" abort pressed " |
|
3842 | 403 |
result := false. |
404 |
^ self. |
|
405 |
] |
|
406 |
] |
|
407 |
]. |
|
408 |
]. |
|
5819 | 409 |
overWriteExisting ifTrue:[ |
3842 | 410 |
Error handle:[:ex| |
411 |
"was not able to copy it" |
|
412 |
result := false. |
|
413 |
self errorString:('on copy file - ', ex description asString). |
|
414 |
( Dialog |
|
415 |
confirm:('error on copy file - ', ex description asString) |
|
416 |
title:'Copy' |
|
417 |
yesLabel:'Continue' |
|
5820 | 418 |
noLabel:'Abort') ifTrue:[ |
419 |
ex proceed. |
|
420 |
] ifFalse:[ |
|
421 |
^ self. |
|
422 |
]. |
|
3842 | 423 |
] do:[ |
424 |
sourceIsDirectory ifTrue:[ |
|
425 |
OperatingSystem recursiveCopyDirectory:(filename asString) |
|
426 |
to:(newFile asString). |
|
427 |
] ifFalse:[ |
|
428 |
filename copyTo:newFile. |
|
429 |
]. |
|
430 |
]. |
|
431 |
self colOfCopiedFiles add:filename |
|
432 |
] |
|
433 |
]. |
|
4006
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
434 |
DirectoryContents flushCachedDirectoryFor:aDirectory. |
3842 | 435 |
result := true. |
436 |
! ! |
|
437 |
||
438 |
!FileOperation::Create class methodsFor:'actions'! |
|
439 |
||
3863 | 440 |
createDirectoryIn:aDirectory |
3842 | 441 |
|
442 |
|instance| |
|
443 |
||
444 |
instance := self new. |
|
3863 | 445 |
instance createDirectoryIn:aDirectory. |
3842 | 446 |
^ instance |
447 |
! |
|
448 |
||
5961 | 449 |
createDirectoryIn:aDirectory initialAnswer:defaultAnswer |
450 |
||
451 |
|instance| |
|
452 |
||
453 |
instance := self new. |
|
454 |
instance createDirectoryIn:aDirectory initialAnswer:defaultAnswer. |
|
455 |
^ instance |
|
456 |
! |
|
457 |
||
3863 | 458 |
createFileIn:aFile |
3842 | 459 |
|
460 |
|instance| |
|
461 |
||
462 |
instance := self new. |
|
3863 | 463 |
instance createFileIn:aFile. |
3842 | 464 |
^ instance |
3877 | 465 |
! |
466 |
||
467 |
createHardLinkIn:aFile |
|
468 |
"create an new hard link in a files directory" |
|
469 |
||
6151 | 470 |
^ self createLinkIn:aFile soft:false |
471 |
! |
|
472 |
||
473 |
createLinkIn:aFile soft:soft |
|
474 |
"create an new soft or hard link in a files directory" |
|
475 |
||
3877 | 476 |
|instance| |
477 |
||
478 |
instance := self new. |
|
6151 | 479 |
instance createLinkIn:aFile soft:soft. |
3877 | 480 |
^ instance |
481 |
! |
|
482 |
||
483 |
createSoftLinkIn:aFile |
|
484 |
"create an new soft link in a files directory" |
|
485 |
||
6151 | 486 |
^ self createLinkIn:aFile soft:true |
3842 | 487 |
! ! |
488 |
||
3863 | 489 |
!FileOperation::Create methodsFor:'accessing'! |
490 |
||
491 |
createdFile |
|
492 |
^ createdFile |
|
493 |
! |
|
494 |
||
495 |
createdFile:something |
|
496 |
createdFile := something. |
|
3842 | 497 |
! ! |
498 |
||
499 |
!FileOperation::Create methodsFor:'actions'! |
|
500 |
||
3863 | 501 |
createDirectoryIn:startDirectory |
4522 | 502 |
|defaultDirectory| |
3863 | 503 |
|
4522 | 504 |
"/ stupid - that one already exists |
505 |
"/ LastCreatedDirectory notNil ifTrue:[ |
|
506 |
"/ defaultDirectory := LastCreatedDirectory baseName. |
|
507 |
"/ ]. |
|
508 |
||
509 |
^ self createDirectoryIn:startDirectory initialAnswer:defaultDirectory |
|
510 |
! |
|
511 |
||
512 |
createDirectoryIn:startDirectory initialAnswer:initialAnswerArg |
|
4584 | 513 |
|resources initialAnswer msg startBaseName newName newDir| |
514 |
||
515 |
resources := AbstractFileBrowser classResources. |
|
3842 | 516 |
|
3863 | 517 |
startBaseName := startDirectory baseName. |
4522 | 518 |
initialAnswer := initialAnswerArg. |
519 |
(startDirectory construct:initialAnswer) exists ifTrue:[ |
|
520 |
initialAnswer := nil. |
|
3863 | 521 |
]. |
6055 | 522 |
Dialog aboutToOpenBoxNotificationSignal ignoreIn:[ |
523 |
newName := Dialog |
|
524 |
request:(resources string:'Create New Directory in %1:' with:startBaseName allBold) |
|
525 |
initialAnswer:initialAnswer |
|
526 |
okLabel:(resources string:'Create') |
|
527 |
title:(resources string:'Create Directory') |
|
528 |
onCancel:[ |
|
529 |
self result:false. |
|
530 |
^ self |
|
531 |
]. |
|
532 |
]. |
|
3863 | 533 |
newName isEmpty ifTrue:[ |
534 |
self result:false. |
|
535 |
^ self |
|
536 |
]. |
|
4522 | 537 |
newDir := startDirectory construct:newName. |
538 |
newDir exists ifTrue:[ |
|
3863 | 539 |
Dialog warn:(newName, ' already exists.'). |
3842 | 540 |
result := false. |
541 |
^ self |
|
542 |
]. |
|
543 |
||
4522 | 544 |
newDir makeDirectory ifFalse:[ |
3850 | 545 |
msg := errorString := ('cannot create directory '', newName,'' !!') , '(', (OperatingSystem lastErrorString) , ')'. |
546 |
errorString := msg. |
|
3863 | 547 |
Dialog warn:errorString. |
3842 | 548 |
result := false. |
549 |
^ self |
|
550 |
]. |
|
4522 | 551 |
self createdFile:newDir. |
552 |
LastCreatedDirectory := newDir. |
|
3842 | 553 |
result := true. |
554 |
! |
|
555 |
||
3863 | 556 |
createFileIn:aFile |
3842 | 557 |
"create an empty file" |
558 |
||
4584 | 559 |
|resources aStream msg file directory newName defaultFile| |
560 |
||
561 |
resources := AbstractFileBrowser classResources. |
|
3842 | 562 |
|
3863 | 563 |
aFile isDirectory ifTrue:[ |
564 |
directory := aFile |
|
565 |
] ifFalse:[ |
|
566 |
directory := aFile directory. |
|
567 |
file := aFile |
|
568 |
]. |
|
569 |
LastCreatedFile isNil ifTrue:[ |
|
570 |
defaultFile := aFile baseName. |
|
571 |
] ifFalse:[ |
|
572 |
defaultFile := LastCreatedFile baseName. |
|
3842 | 573 |
]. |
3863 | 574 |
newName := Dialog |
4585 | 575 |
request:(resources string:'Create New File in %1:' with:directory baseName allBold) |
3863 | 576 |
initialAnswer:defaultFile |
4584 | 577 |
okLabel:(resources string:'Create') |
578 |
title:(resources string:'Create File') |
|
3863 | 579 |
onCancel:[ |
580 |
self result:false. |
|
581 |
^ self |
|
582 |
]. |
|
583 |
newName isEmpty ifTrue:[ |
|
584 |
self result:false. |
|
3842 | 585 |
] ifFalse:[ |
3863 | 586 |
| newFile | |
587 |
newFile := directory construct:newName. |
|
588 |
newFile exists ifTrue:[ |
|
589 |
(Dialog |
|
590 |
confirm:(newName, ' already exists truncate ?') |
|
591 |
yesLabel:('Truncate') |
|
592 |
noLabel:('Cancel')) |
|
593 |
ifFalse:[ |
|
594 |
self result:false. |
|
595 |
^ self |
|
596 |
]. |
|
597 |
]. |
|
598 |
FileStream openErrorSignal handle:[:ex| |
|
599 |
msg := ('Cannot create file '', newName,'' !!') , '(' , (FileStream lastErrorString) , ')'. |
|
600 |
errorString := msg. |
|
601 |
self result:false. |
|
602 |
^ Dialog warn:errorString |
|
603 |
] do:[ |
|
604 |
aStream := newFile newReadWriteStream. |
|
605 |
]. |
|
4637
46517dedc503
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4627
diff
changeset
|
606 |
aStream close. |
46517dedc503
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4627
diff
changeset
|
607 |
self createdFile:newFile. |
46517dedc503
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4627
diff
changeset
|
608 |
LastCreatedFile := newFile. |
46517dedc503
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4627
diff
changeset
|
609 |
self result:true. |
3842 | 610 |
]. |
3877 | 611 |
! |
612 |
||
613 |
createHardLinkIn:aFile |
|
614 |
"create an new hard link in a files directory" |
|
615 |
||
616 |
self createLinkIn:aFile soft:false. |
|
617 |
! |
|
618 |
||
619 |
createLinkIn:aFile soft:symbolic |
|
4788 | 620 |
"ask for the link target; |
621 |
then, create an new soft or hard link in aFile's directory" |
|
3877 | 622 |
|
4788 | 623 |
|resources newPath oldPath box string if1 if2| |
4584 | 624 |
|
625 |
resources := AbstractFileBrowser classResources. |
|
3877 | 626 |
|
627 |
aFile isDirectory ifTrue:[ |
|
628 |
newPath := aFile asValue. |
|
629 |
oldPath := aFile asValue. |
|
630 |
] ifFalse:[ |
|
631 |
newPath := aFile directory asValue. |
|
632 |
oldPath := aFile asValue. |
|
633 |
]. |
|
634 |
||
635 |
box := Dialog new. |
|
4585 | 636 |
box label:'Create Link'. |
637 |
||
638 |
string := 'Create ', (symbolic ifTrue:['Symbolic'] ifFalse:['Hard']) ,' Link from:'. |
|
4584 | 639 |
(box addTextLabel:(resources string:string)) adjust:#left. |
6150
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
640 |
if1 := box addFilenameInputFieldOn:oldPath in:nil tabable:true. |
4584 | 641 |
(box addTextLabel:(resources string:'to:')) adjust:#left. |
6150
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
642 |
if2 := box addFilenameInputFieldOn:newPath in:nil value tabable:true. |
3877 | 643 |
|
644 |
box addAbortAndOkButtons. |
|
645 |
||
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6185
diff
changeset
|
646 |
aFile isDirectory ifFalse:[ |
3877 | 647 |
box focusOnField:if1. |
648 |
]. |
|
649 |
box showAtPointer. |
|
650 |
||
4788 | 651 |
box accepted ifFalse:[ |
652 |
self result:false. |
|
653 |
] ifTrue:[ |
|
654 |
self doCreateLinkFrom:(oldPath value) to:(newPath value) soft:symbolic. |
|
3877 | 655 |
]. |
656 |
! |
|
657 |
||
658 |
createSoftLinkIn:aFile |
|
659 |
"create an new soft link in a files directory" |
|
660 |
||
661 |
self createLinkIn:aFile soft:true. |
|
4788 | 662 |
! |
663 |
||
6150
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
664 |
doCreateLinkFrom:oldPath to:newPathArg soft:symbolic |
4788 | 665 |
"actually create a soft or hard link" |
666 |
||
6150
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
667 |
|resources err newPath newPathFile oldPathFile| |
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
668 |
|
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
669 |
newPath := newPathArg. |
4788 | 670 |
|
671 |
resources := AbstractFileBrowser classResources. |
|
672 |
||
673 |
(oldPath size == 0) ifTrue:[ |
|
6150
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
674 |
self operationError:'Missing source'. |
4788 | 675 |
^ self. |
676 |
]. |
|
677 |
(newPath size == 0) ifTrue:[ |
|
6150
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
678 |
self operationError:'Missing link name (target)'. |
4788 | 679 |
^ self. |
680 |
]. |
|
681 |
||
682 |
newPathFile := newPath asFilename. |
|
6150
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
683 |
oldPathFile := oldPath asFilename. |
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
684 |
|
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
685 |
newPathFile exists ifTrue:[ |
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
686 |
newPathFile isDirectory ifTrue:[ |
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
687 |
newPathFile := newPathFile construct:(oldPathFile baseName). |
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
688 |
newPath := newPathFile name. |
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
689 |
]. |
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
690 |
]. |
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
691 |
|
4788 | 692 |
newPathFile exists ifTrue:[ |
693 |
self operationError:(resources string:'%1 already exists' with:newPath allBold). |
|
694 |
^ self. |
|
695 |
]. |
|
6150
5028485a29c6
fixed new-symbolic link operation
Claus Gittinger <cg@exept.de>
parents:
6088
diff
changeset
|
696 |
oldPathFile exists ifFalse:[ |
4788 | 697 |
symbolic ifTrue:[ |
698 |
oldPathFile isAbsolute ifTrue:[ |
|
699 |
self operationError:(resources string:'%1 does not exist' with:oldPath allBold). |
|
700 |
^ self. |
|
701 |
]. |
|
702 |
(newPathFile directory construct:oldPath) exists ifFalse:[ |
|
703 |
Dialog warn:(resources string:'%1 does not exist (Warning only)' with:oldPath allBold). |
|
704 |
]. |
|
705 |
] ifFalse:[ |
|
706 |
self operationError:(resources string:'%1 does not exist' with:oldPath allBold). |
|
707 |
^ self. |
|
708 |
]. |
|
709 |
]. |
|
710 |
((symbolic not) and:[oldPathFile isDirectory]) ifTrue:[ |
|
711 |
self operationError:(resources string:'%1 is a directory' with:oldPath allBold). |
|
712 |
^ self. |
|
713 |
]. |
|
714 |
ErrorSignal handle:[:ex | |
|
715 |
err := ex errorString. |
|
716 |
self operationError:err. |
|
717 |
] do:[ |
|
718 |
symbolic ifTrue:[ |
|
719 |
OperatingSystem createSymbolicLinkFrom:oldPath to:newPath. |
|
720 |
] ifFalse:[ |
|
721 |
OperatingSystem createHardLinkFrom:oldPath to:newPath |
|
722 |
]. |
|
723 |
self createdFile:newPathFile. |
|
724 |
self result:true. |
|
725 |
]. |
|
726 |
! |
|
727 |
||
728 |
operationError:msg |
|
729 |
self result:false. |
|
730 |
Dialog warn:msg. |
|
731 |
self errorString:msg. |
|
3842 | 732 |
! ! |
733 |
||
734 |
!FileOperation::Delete class methodsFor:'actions'! |
|
735 |
||
736 |
deleteFile:aFileOrDirectory |
|
6168 | 737 |
"delete aFileOrDirectory" |
3842 | 738 |
|
739 |
|instance| |
|
740 |
||
741 |
instance := self new. |
|
742 |
instance deleteFile:aFileOrDirectory. |
|
743 |
^ instance |
|
744 |
! |
|
745 |
||
6168 | 746 |
deleteFiles:aCollectionOfFiles |
747 |
^ self deleteFiles:aCollectionOfFiles confirm:true |
|
5081 | 748 |
! |
749 |
||
6168 | 750 |
deleteFiles:aCollectionOfFiles confirm:confirm |
751 |
"delete aCollectionOfFiles" |
|
3842 | 752 |
|
753 |
|instance| |
|
754 |
||
755 |
instance := self new. |
|
6168 | 756 |
instance deleteFiles:aCollectionOfFiles confirm:confirm. |
3842 | 757 |
^ instance |
758 |
! ! |
|
759 |
||
760 |
!FileOperation::Delete methodsFor:'actions'! |
|
761 |
||
762 |
deleteFile:aFileOrDirectory |
|
763 |
| file isDirectory | |
|
764 |
||
765 |
aFileOrDirectory notNil ifTrue:[ |
|
766 |
file := aFileOrDirectory asFilename. |
|
767 |
||
4665
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
768 |
isDirectory := file isDirectory. |
3842 | 769 |
|
4665
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
770 |
Error handle:[:ex| |
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
771 |
"was not able to remove it" |
5746
a505fc181e11
warning string (backslash in pc-filename)
Claus Gittinger <cg@exept.de>
parents:
5687
diff
changeset
|
772 |
Dialog warn:(ex description, '\' withCRs, ex signal notifierString). |
a505fc181e11
warning string (backslash in pc-filename)
Claus Gittinger <cg@exept.de>
parents:
5687
diff
changeset
|
773 |
self errorString:(ex description, ' - ', ex signal notifierString). |
4665
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
774 |
result := false. |
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
775 |
^ self. |
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
776 |
] do:[ |
6168 | 777 |
isDirectory ifTrue:[ |
778 |
file recursiveRemove |
|
779 |
] ifFalse:[ |
|
780 |
self eraseFilesContentsBeforeRemoving:file. |
|
781 |
file remove |
|
782 |
]. |
|
4665
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
783 |
]. |
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
784 |
"/ flush parent directory or directory |
3842 | 785 |
]. |
4006
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
786 |
DirectoryContents flushCachedDirectoryFor:(file directory). |
3842 | 787 |
result := true. |
5746
a505fc181e11
warning string (backslash in pc-filename)
Claus Gittinger <cg@exept.de>
parents:
5687
diff
changeset
|
788 |
|
a505fc181e11
warning string (backslash in pc-filename)
Claus Gittinger <cg@exept.de>
parents:
5687
diff
changeset
|
789 |
"Modified: / 17-03-2004 / 12:42:02 / cg" |
3842 | 790 |
! |
791 |
||
792 |
deleteFiles:colOfFiles |
|
5081 | 793 |
^ self deleteFiles:colOfFiles confirm:true. |
794 |
! |
|
4584 | 795 |
|
5081 | 796 |
deleteFiles:colOfFiles confirm:confirm |
5805 | 797 |
|resources answer nFilesToDelete ask labels values fileTypeString msg lbls vals| |
5081 | 798 |
|
799 |
ask := confirm. |
|
4584 | 800 |
resources := AbstractFileBrowser classResources. |
3842 | 801 |
|
4701 | 802 |
nFilesToDelete := colOfFiles size. |
4408
8c0c80b68ae7
ask again, if dir is not empty
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
803 |
colOfFiles do:[:filenameOrString | |
5673 | 804 |
|filename askForNonEmptyDirectory skip| |
4408
8c0c80b68ae7
ask again, if dir is not empty
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
805 |
|
8c0c80b68ae7
ask again, if dir is not empty
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
806 |
filename := filenameOrString asFilename. |
4665
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
807 |
|
5673 | 808 |
skip := false. |
4665
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
809 |
fileTypeString := ''. |
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
810 |
filename isSymbolicLink ifTrue:[ |
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
811 |
fileTypeString := 'symbolic link '. |
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
812 |
] ifFalse:[ |
5673 | 813 |
filename exists ifFalse:[ |
814 |
(Dialog |
|
5846 | 815 |
confirm:('%1 does not exist.' bindWith:filename asString allBold) |
816 |
yesLabel:(resources string:'Proceed') |
|
5673 | 817 |
noLabel:(resources string:'Cancel')) |
818 |
ifFalse:[ |
|
819 |
^ self. |
|
820 |
]. |
|
821 |
skip := true. |
|
4665
cd7e02bf5d85
fixed to allow deleting bad symbolic links
Claus Gittinger <cg@exept.de>
parents:
4664
diff
changeset
|
822 |
] |
4423 | 823 |
]. |
5673 | 824 |
skip ifFalse:[ |
825 |
ask ifTrue:[ |
|
826 |
nFilesToDelete = 1 ifTrue:[ |
|
827 |
labels := #('No' 'Yes'). |
|
828 |
values := #(#no #yes). |
|
829 |
] ifFalse:[ |
|
830 |
labels := #('Cancel' 'No' 'Yes' 'Yes to All' ). |
|
831 |
values := #(#cancel #no #yes #yesToAll). |
|
832 |
]. |
|
5805 | 833 |
msg := nFilesToDelete = 1 |
834 |
ifTrue:'Really delete\\%1%2 ?' |
|
835 |
ifFalse:'Really delete\\%1%2 \\(%3 files alltogether)'. |
|
6088 | 836 |
Dialog aboutToOpenBoxNotificationSignal handle:[:ex | ex proceed] |
837 |
do:[ |
|
838 |
answer := Dialog |
|
839 |
confirmWithCancel:(resources |
|
840 |
stringWithCRs:msg |
|
841 |
with:fileTypeString |
|
842 |
with:(filename asString allBold) |
|
843 |
with:nFilesToDelete) |
|
844 |
labels:(resources array:labels) |
|
845 |
values:values |
|
846 |
default:(values indexOf:#yes). |
|
847 |
] |
|
3842 | 848 |
] ifFalse:[ |
5673 | 849 |
answer := #yesToAll. |
3977 | 850 |
]. |
5673 | 851 |
|
852 |
answer == #cancel ifTrue:[ |
|
853 |
^ self. |
|
854 |
]. |
|
855 |
||
856 |
answer == #yesToAll ifTrue:[ |
|
857 |
ask := false. |
|
858 |
answer := #yes. |
|
859 |
]. |
|
4408
8c0c80b68ae7
ask again, if dir is not empty
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
860 |
|
5673 | 861 |
answer == #yes ifTrue:[ |
862 |
askForNonEmptyDirectory := true. |
|
863 |
filename isSymbolicLink ifFalse:[ |
|
864 |
filename isNonEmptyDirectory ifTrue:[ |
|
5805 | 865 |
colOfFiles size == 1 ifTrue:[ |
866 |
lbls := #('Cancel' 'Remove'). |
|
867 |
vals := #(false true). |
|
868 |
] ifFalse:[ |
|
869 |
lbls := #('Cancel All' 'Keep' 'Remove'). |
|
870 |
vals := #(nil false true). |
|
871 |
]. |
|
5673 | 872 |
askForNonEmptyDirectory := Dialog |
5805 | 873 |
confirmWithCancel:(resources |
874 |
stringWithCRs:'Directory ''%1'' is not empty\remove anyway ?' |
|
875 |
with:filename pathName allBold) |
|
876 |
labels:( resources array:lbls ) |
|
877 |
values:vals |
|
878 |
default:vals size. |
|
5673 | 879 |
askForNonEmptyDirectory == nil ifTrue:[ |
880 |
^ self |
|
881 |
]. |
|
5342
4ea3ee096611
deletion of symbolic links pointing to a directory
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
882 |
]. |
4637
46517dedc503
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
4627
diff
changeset
|
883 |
]. |
5673 | 884 |
askForNonEmptyDirectory ifTrue:[ |
885 |
self deleteFile:filename. |
|
886 |
] |
|
4408
8c0c80b68ae7
ask again, if dir is not empty
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
887 |
]. |
8c0c80b68ae7
ask again, if dir is not empty
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
888 |
]. |
3842 | 889 |
]. |
6168 | 890 |
! |
891 |
||
892 |
eraseFilesContentsBeforeRemoving:file |
|
893 |
"intentionally left blank" |
|
894 |
! ! |
|
895 |
||
896 |
!FileOperation::Erase methodsFor:'actions'! |
|
897 |
||
898 |
eraseFilesContentsBeforeRemoving |
|
899 |
"fill file with zeros" |
|
900 |
||
901 |
self halt. |
|
902 |
! |
|
903 |
||
904 |
eraseFilesContentsBeforeRemoving:file |
|
905 |
"fill file with zeros (to be really erased from the disk)" |
|
906 |
||
907 |
|writeStream fileSize remaining buffer bufferSize nWritten| |
|
908 |
||
909 |
fileSize := file fileSize. |
|
910 |
writeStream := file asFilename readWriteStream. |
|
911 |
||
912 |
remaining := fileSize. |
|
913 |
bufferSize := 8192. |
|
914 |
buffer := ByteArray new:bufferSize. |
|
915 |
[remaining > 0] whileTrue:[ |
|
916 |
nWritten := writeStream |
|
917 |
nextPutBytes:(bufferSize min:remaining) |
|
918 |
from:buffer |
|
919 |
startingAt:1. |
|
920 |
remaining := remaining - nWritten. |
|
921 |
]. |
|
922 |
writeStream close. |
|
3842 | 923 |
! ! |
924 |
||
925 |
!FileOperation::Move class methodsFor:'actions'! |
|
926 |
||
927 |
moveFile:aSourceFile to:aDestFile |
|
928 |
|instance| |
|
929 |
||
930 |
instance := self new. |
|
931 |
instance moveFile:aSourceFile to:aDestFile. |
|
932 |
^ instance |
|
933 |
! |
|
934 |
||
935 |
moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning |
|
936 |
|instance| |
|
937 |
||
938 |
instance := self new. |
|
939 |
instance moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning. |
|
940 |
^ instance |
|
941 |
! |
|
942 |
||
943 |
moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning moveFileIfSame:move |
|
944 |
|instance| |
|
945 |
||
946 |
instance := self new. |
|
947 |
instance moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning moveFileIfSame:move. |
|
948 |
^ instance |
|
949 |
! |
|
950 |
||
951 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
952 |
|instance| |
|
953 |
||
954 |
instance := self new. |
|
955 |
instance moveFiles:aColOfSourceFiles to:aDirectory. |
|
956 |
^ instance |
|
957 |
! |
|
958 |
||
959 |
moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning |
|
960 |
|instance| |
|
961 |
||
962 |
instance := self new. |
|
963 |
instance moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning. |
|
964 |
^ instance |
|
965 |
! |
|
966 |
||
967 |
moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:move |
|
968 |
|instance| |
|
969 |
||
970 |
instance := self new. |
|
971 |
instance moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:move. |
|
972 |
^ instance |
|
973 |
! ! |
|
974 |
||
975 |
!FileOperation::Move methodsFor:'accessing'! |
|
976 |
||
977 |
colOfMovedFiles |
|
978 |
colOfMovedFiles isNil ifTrue:[ |
|
979 |
colOfMovedFiles := OrderedCollection new. |
|
980 |
]. |
|
981 |
^ colOfMovedFiles |
|
982 |
! ! |
|
983 |
||
984 |
!FileOperation::Move methodsFor:'actions'! |
|
985 |
||
986 |
moveFile:aSourceFile to:aDestFile |
|
987 |
||
988 |
^ self moveFile:aSourceFile to:aDestFile withOverWriteWarning:true. |
|
989 |
! |
|
990 |
||
991 |
moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning |
|
992 |
||
993 |
^ self moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning moveFileIfSame:true |
|
994 |
! |
|
995 |
||
996 |
moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning moveFileIfSame:move |
|
997 |
||
5862 | 998 |
|newFile fileString targetDirectory targetIsDirectory suffix doMove| |
3842 | 999 |
|
1000 |
targetIsDirectory := aDestFile isDirectory. |
|
1001 |
targetIsDirectory ifTrue:[ |
|
1002 |
targetDirectory := aDestFile. |
|
1003 |
newFile := aDestFile construct:(aSourceFile baseName). |
|
1004 |
] ifFalse:[ |
|
1005 |
targetDirectory := aDestFile directory. |
|
1006 |
newFile := aDestFile. |
|
1007 |
]. |
|
1008 |
"/ do not copy if destination directory doest exist. |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6185
diff
changeset
|
1009 |
targetDirectory exists ifFalse:[ |
4522 | 1010 |
Dialog warn:'Cannot move to non-existing directory ', targetDirectory asString. |
3842 | 1011 |
result := false. |
1012 |
^ self |
|
1013 |
]. |
|
1014 |
(newFile exists) ifTrue:[ |
|
1015 |
((newFile asString = aSourceFile asString) and:[move]) ifTrue:[ |
|
1016 |
[newFile exists] whileTrue:[ |
|
1017 |
suffix := newFile suffix. |
|
6168 | 1018 |
fileString := newFile baseName withoutSuffix, self class suffixForCopyOverExistingFile, '.', suffix. |
3842 | 1019 |
newFile := targetDirectory construct:fileString. |
1020 |
]. |
|
1021 |
] ifFalse:[ |
|
1022 |
overWriteWarning ifTrue:[ |
|
6168 | 1023 |
doMove := self fileExistsDialogForNewFile:newFile oldFile:aSourceFile withCancel:false withRemoveIfSame:true. |
5862 | 1024 |
doMove == #removeSource ifTrue:[ |
1025 |
self halt. |
|
1026 |
result := false. |
|
1027 |
^ self. |
|
1028 |
]. |
|
1029 |
doMove == #removeDestination ifTrue:[ |
|
1030 |
self halt. |
|
3842 | 1031 |
result := false. |
1032 |
^ self. |
|
5862 | 1033 |
]. |
1034 |
doMove == true ifFalse:[ |
|
3842 | 1035 |
result := false. |
1036 |
^ self. |
|
5862 | 1037 |
]. |
1038 |
||
1039 |
] ifFalse:[ |
|
1040 |
result := false. |
|
1041 |
^ self. |
|
3842 | 1042 |
] |
1043 |
]. |
|
1044 |
]. |
|
1045 |
Error handle:[:ex| |
|
1046 |
"was not able to copy it" |
|
4522 | 1047 |
WarningBox warn:'Error in copy file Operation: ', ex errorString. |
1048 |
self errorString:('Error in copy file Operation- ', ex description asString). |
|
3842 | 1049 |
result := false. |
4006
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
1050 |
^ self |
3842 | 1051 |
] do:[ |
1052 |
aSourceFile moveTo:newFile. |
|
1053 |
]. |
|
4006
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
1054 |
DirectoryContents flushCachedDirectoryFor:(aSourceFile directory). |
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
1055 |
result := true. |
3842 | 1056 |
! |
1057 |
||
1058 |
moveFiles:aColOfSourceFiles to:aDirectory |
|
1059 |
||
1060 |
^ self moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:true |
|
1061 |
! |
|
1062 |
||
1063 |
moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning |
|
1064 |
||
1065 |
^ self moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:true |
|
1066 |
! |
|
1067 |
||
1068 |
moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:move |
|
1069 |
||
5862 | 1070 |
|newFile suffix fileString doMove doRemoveSource doRemoveDestination| |
3842 | 1071 |
|
5854
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1072 |
aDirectory exists ifFalse:[ |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1073 |
(Dialog confirm:(FileBrowser classResources |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1074 |
stringWithCRs:'Non-existing directory "%1" .\Create ?' |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1075 |
with:aDirectory asString allBold)) ifFalse:[ |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1076 |
result := false. |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1077 |
^ self |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1078 |
]. |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1079 |
aDirectory makeDirectory. |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1080 |
aDirectory exists ifFalse:[ |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1081 |
Dialog warn:(FileBrowser classResources |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1082 |
stringWithCRs:'Cannot create directory "%1" !!\Create ?.' |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1083 |
with:aDirectory asString allBold). |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1084 |
result := false. |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1085 |
^ self |
8c6042ba7495
ask if non-existing directory should be created
Claus Gittinger <cg@exept.de>
parents:
5846
diff
changeset
|
1086 |
] |
3842 | 1087 |
]. |
5788 | 1088 |
(aDirectory isDirectory) ifFalse:[ |
4522 | 1089 |
Dialog warn:('Destination %1 is not a directory.' bindWith:aDirectory asString allBold). |
3842 | 1090 |
result := false. |
1091 |
^ self |
|
1092 |
]. |
|
1093 |
aColOfSourceFiles do:[: filename | |
|
1094 |
newFile := aDirectory construct:filename baseName. |
|
5790 | 1095 |
|
1096 |
doMove := true. |
|
5862 | 1097 |
doRemoveSource := false. |
1098 |
doRemoveDestination := false. |
|
1099 |
||
3842 | 1100 |
(newFile exists) ifTrue:[ |
1101 |
((newFile asString = filename asString) and:[move]) ifTrue:[ |
|
1102 |
[newFile exists] whileTrue:[ |
|
1103 |
suffix := newFile suffix. |
|
6168 | 1104 |
fileString := newFile withoutSuffix baseName , self class suffixForCopyOverExistingFile, '.', suffix. |
3842 | 1105 |
newFile := aDirectory construct:fileString. |
1106 |
]. |
|
1107 |
] ifFalse:[ |
|
1108 |
overWriteWarning ifTrue:[ |
|
6168 | 1109 |
doMove := self fileExistsDialogForNewFile:newFile oldFile:filename withCancel:(aColOfSourceFiles size > 1) withRemoveIfSame:true. |
5862 | 1110 |
doMove isNil ifTrue:[ "/ cancel |
3842 | 1111 |
result := false. |
1112 |
^ self. |
|
5862 | 1113 |
]. |
1114 |
(doMove == #removeSource) ifTrue:[ |
|
1115 |
doRemoveSource := true. |
|
1116 |
doMove := false |
|
1117 |
] ifFalse:[ |
|
1118 |
(doMove == #removeDestination) ifTrue:[ |
|
1119 |
doRemoveDestination := true. |
|
1120 |
doMove := false |
|
1121 |
] |
|
3842 | 1122 |
] |
1123 |
] |
|
1124 |
]. |
|
1125 |
]. |
|
4522 | 1126 |
|
5862 | 1127 |
(doMove or:[doRemoveSource or:[doRemoveDestination]]) ifTrue:[ |
3842 | 1128 |
Error handle:[:ex| |
1129 |
"was not able to copy it" |
|
5862 | 1130 |
|descriptionString| |
1131 |
||
3842 | 1132 |
result := false. |
5862 | 1133 |
descriptionString := ex description asString. |
1134 |
self errorString:(' Error in Move-File Operation:', descriptionString). |
|
3842 | 1135 |
( Dialog |
5862 | 1136 |
confirm:(' Error in Move-File Operation: ', descriptionString) |
3842 | 1137 |
title:'Move' |
1138 |
yesLabel:'Continue' |
|
5862 | 1139 |
noLabel:'Abort' |
1140 |
) ifFalse:[ |
|
3842 | 1141 |
^ self. |
1142 |
]. |
|
1143 |
] do:[ |
|
5862 | 1144 |
doRemoveSource ifTrue:[ |
1145 |
filename remove |
|
1146 |
] ifFalse:[ |
|
1147 |
doRemoveDestination ifTrue:[ |
|
1148 |
newFile remove |
|
1149 |
] ifFalse:[ |
|
1150 |
filename moveTo:newFile. |
|
1151 |
] |
|
1152 |
] |
|
3842 | 1153 |
]. |
1154 |
self colOfMovedFiles add:filename |
|
1155 |
] |
|
1156 |
]. |
|
4006
8c706ba8b3b5
change flushCachedDirectory: senders to flushCachedDirectoryFor:
penk
parents:
3977
diff
changeset
|
1157 |
DirectoryContents flushCachedDirectoryFor:aDirectory. |
3842 | 1158 |
result := true. |
1159 |
! ! |
|
1160 |
||
1161 |
!FileOperation::Rename class methodsFor:'actions'! |
|
1162 |
||
1163 |
renameFile:oldFile to:newName |
|
1164 |
|instance| |
|
1165 |
||
1166 |
instance := self new. |
|
1167 |
instance renameFile:oldFile to:newName. |
|
1168 |
^ instance |
|
1169 |
! |
|
1170 |
||
1171 |
renameFiles:aColOfFiles |
|
1172 |
|instance| |
|
1173 |
||
1174 |
instance := self new. |
|
1175 |
instance renameFiles:aColOfFiles. |
|
1176 |
^ instance |
|
1177 |
! ! |
|
1178 |
||
1179 |
!FileOperation::Rename methodsFor:'accessing'! |
|
1180 |
||
1181 |
renamedFiles |
|
1182 |
renamedFiles isNil ifTrue:[ |
|
1183 |
renamedFiles := OrderedCollection new. |
|
1184 |
]. |
|
1185 |
^ renamedFiles |
|
1186 |
! ! |
|
1187 |
||
1188 |
!FileOperation::Rename methodsFor:'actions'! |
|
1189 |
||
1190 |
renameFile:oldFile to:newName |
|
1191 |
"rename a file (or directory)" |
|
1192 |
||
5656 | 1193 |
|newFile msg resources| |
3842 | 1194 |
|
1195 |
(oldFile isNil or:[newName isNil]) ifTrue:[ |
|
5656 | 1196 |
result := false. |
1197 |
^ self. |
|
3842 | 1198 |
]. |
1199 |
(oldFile asString isBlank or:[newName isBlank]) ifTrue:[ |
|
5656 | 1200 |
result := false. |
1201 |
^ self. |
|
3842 | 1202 |
]. |
5656 | 1203 |
newName asFilename isAbsolute ifTrue:[ |
1204 |
newFile := newName asFilename. |
|
1205 |
] ifFalse:[ |
|
1206 |
(oldFile baseName = newName) ifTrue:[ |
|
1207 |
result := false |
|
1208 |
]. |
|
1209 |
newFile := oldFile directory construct:newName. |
|
3842 | 1210 |
]. |
1211 |
||
5656 | 1212 |
oldFile pathName = newFile pathName ifTrue:[ |
4674
64a49fadc47e
do op if newName is same as old in a rename operation
Claus Gittinger <cg@exept.de>
parents:
4665
diff
changeset
|
1213 |
^ self. |
64a49fadc47e
do op if newName is same as old in a rename operation
Claus Gittinger <cg@exept.de>
parents:
4665
diff
changeset
|
1214 |
]. |
64a49fadc47e
do op if newName is same as old in a rename operation
Claus Gittinger <cg@exept.de>
parents:
4665
diff
changeset
|
1215 |
|
5656 | 1216 |
resources := Dialog classResources. |
1217 |
||
3842 | 1218 |
OperatingSystem errorSignal handle:[:ex| |
5656 | 1219 |
msg := resources |
1220 |
stringWithCRs:'Cannot rename file %1 to %2 !!\\(%3)' |
|
1221 |
with:oldFile baseName |
|
1222 |
with:newName |
|
1223 |
with:(OperatingSystem lastErrorString). |
|
3863 | 1224 |
Dialog warn:msg withCRs. |
4882 | 1225 |
result := false. |
1226 |
^ self. |
|
3842 | 1227 |
] do:[ |
5656 | 1228 |
newFile exists ifTrue:[ |
1229 |
(newFile sameContentsAs:oldFile) ifTrue:[ |
|
1230 |
msg := '%1 exists [with same contents] - rename (i.e. overwrite) anyway ?' |
|
1231 |
] ifFalse:[ |
|
1232 |
msg := '%1 exists - rename (i.e. overwrite) anyway ?' |
|
1233 |
]. |
|
1234 |
(Dialog confirmWithCancel:(resources string:msg with:newName allBold) default:false) ifFalse:[ |
|
3842 | 1235 |
result := false. |
1236 |
^ self. |
|
1237 |
] |
|
1238 |
]. |
|
5656 | 1239 |
oldFile renameTo:newFile. |
1240 |
self renamedFiles add:newFile. |
|
3842 | 1241 |
]. |
1242 |
result := true. |
|
1243 |
! |
|
1244 |
||
1245 |
renameFiles:aColOfFiles |
|
5827 | 1246 |
|resources queryBox b lastNewName lastOldName initialText oldName newName renameAll doRename| |
4584 | 1247 |
|
1248 |
resources := AbstractFileBrowser classResources. |
|
5827 | 1249 |
renameAll := false. |
3842 | 1250 |
|
1251 |
queryBox := FilenameEnterBox new. |
|
4584 | 1252 |
queryBox okText:(resources string:'Rename'). |
5827 | 1253 |
|
3842 | 1254 |
aColOfFiles size > 1 ifTrue:[ |
4584 | 1255 |
b := queryBox addAbortButtonLabelled:(resources string:'Cancel All'). |
5827 | 1256 |
b action:[^ self]. |
1257 |
queryBox addButton:(Button label:(resources string:'Rename All') action:[renameAll := true. queryBox okPressed]) before:(queryBox okButton). |
|
3842 | 1258 |
]. |
5827 | 1259 |
aColOfFiles do:[:oldFile | |
3842 | 1260 |
oldName := oldFile baseName asString. |
1261 |
lastNewName notNil ifTrue:[ |
|
6153 | 1262 |
initialText := FileBrowser goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName. |
3842 | 1263 |
]. |
5827 | 1264 |
doRename := false. |
6153 | 1265 |
(renameAll and:[initialText notNil]) ifTrue:[ |
5827 | 1266 |
doRename := true. |
1267 |
newName := initialText. |
|
1268 |
] ifFalse:[ |
|
1269 |
queryBox title:(resources string:'Rename %1 to:' with:(oldName allBold)). |
|
1270 |
queryBox initialText:(initialText ? oldName). |
|
1271 |
queryBox action:[:newEnteredName | newName := newEnteredName. doRename := true.]. |
|
1272 |
queryBox show "showAtPointer". |
|
6185 | 1273 |
"/ queryBox accepted ifFalse:[self halt]. |
5827 | 1274 |
]. |
1275 |
doRename ifTrue:[ |
|
1276 |
(self renameFile:oldFile to:newName asString) ifTrue:[ |
|
1277 |
result := true |
|
3842 | 1278 |
]. |
5827 | 1279 |
lastOldName := oldName. |
1280 |
lastNewName := newName. |
|
1281 |
]. |
|
3842 | 1282 |
] |
1283 |
! ! |
|
1284 |
||
3841 | 1285 |
!FileOperation class methodsFor:'documentation'! |
1286 |
||
1287 |
version |
|
6250
5b0673ccff1c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
6185
diff
changeset
|
1288 |
^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.66 2005-04-14 09:12:32 cg Exp $' |
3841 | 1289 |
! ! |