home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
opus
/
v4
/
versioncopy
/
vcopy.dopus.source
< prev
next >
Wrap
Text File
|
1977-12-31
|
3KB
|
108 lines
/**********************************************
VersionCopy v2.0
Checking version numbers before copying.
For use with directoryopus.
$VER: VersionCopy 2.0 (9.8.94)
**********************************************/
options results
lf='0a'x;chk=1
status 3;nr=result
status 9 nr;turns=result
do turns
call routine
end
return
Routine:
/****************
Get sourcename
****************/
getnextselected;filename=result
status 3;winnr=result
status 13 winnr;source=result
/**********************
Get destination path
**********************/
if winnr=1 then winnr2=0
if winnr=0 then winnr2=1
status 13 winnr2;dest=result
/***************************
Check for duplicate files
***************************/
if exists(dest||filename)=0 then do;call copyfile;return;end
/**************************************
Get version for source & destination
**************************************/
address command 'c:version "'source||filename'" full >t:dopustemp.tmp0'
address command 'c:version "'dest||filename'" full >t:dopustemp.tmp1'
open('file0',"t:dopustemp.tmp0")
line0=readln('file0')
ver0=word(line0,2)
open('file1',"t:dopustemp.tmp1")
line1=readln('file1')
ver1=word(line1,2)
if ver0="not" & ver1="not" then;do;call copyfile;return;end
if ver0="not" then ver0=" - "
if ver1="not" then ver1=" - "
/*******************
Get creation date
*******************/
p2=index(line0,')');p1=index(line0,'(');len=p2-p1+1
if p1*p2=0 then do;date0="";p1=1;p2=0;end
if p2>p1 then date0=right(line0,len)
p2=index(line1,')');p1=index(line1,'(');len=p2-p1+1
if p1*p2=0 then do;date1="";p1=1;p2=0;end
if p2>p1 then date1=right(line1,len)
if length(date0)<12 then do
line0=readln('file0')
p2=index(line0,')');p1=index(line0,'(');len=p2-p1+1
if p1*p2=0 then do;date0="(Unknown Date)";p1=1;p2=0;end
if p2>p1 then date0=left(line0,len);end
if length(date1)<12 then do
line1=readln('file1')
p2=index(line1,')');p1=index(line1,'(');len=p2-p1+1
if p1*p2=0 then do;date1="(Unknown Date)";p1=1;p2=0;end
if p2>p1 then date1=left(line1,len,0);end
if length(date0)<5^length(date0)>18 then date0="(Unknown Date)"
if length(date1)<5^length(date1)>18 then date1="(Unknown Date)"
/***********
Requester
***********/
toptext 'VersionCopy found duplicate file - "'filename'"'
status 27;old_cancel=result
status 27 set "Skip"
request ' New version: 'ver0' 'date0' '||lf' Old version: 'ver1' 'date1' '||lf||lf'Do you want to continue?'
if ~result=1 then do;close('file0');close('file1');end
if ~result=0 then call copyfile
status 27 set old_cancel
selectfile filename 0 1
Return
/**************
Copy routine
**************/
copyfile:
copy filename
close('file0')
close('file1')
selectfile filename 0 1
return
/**/