r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Graham
6-Oct-2010
[18610]
I would have thought that logically the file on the other pc is for 
the time owned by the original pc
Ladislav
6-Oct-2010
[18611]
Does the SET-MODES function work for you in R2.7.7?
Graham
6-Oct-2010
[18612x2]
Haven't tried ... not for many years
There's no way PC1 can know what time it is on PC2
Ladislav
6-Oct-2010
[18614x2]
There is: Touch a file and get its time
;-)
Graham
6-Oct-2010
[18616]
that implies the resource on pc2 has a touch facility
Ladislav
6-Oct-2010
[18617]
Actually, that is why I am using the Touch function
Graham
6-Oct-2010
[18618]
no watch??
Ladislav
6-Oct-2010
[18619x3]
right
(I just do not know on which machine the file is)
a related problem: how to remove the last character from a file in 
R3?
Graham
6-Oct-2010
[18622x2]
In my file replication tool I hit a snag ... when replicating directories 
I was not able to set the file date :(
ie. get-modes can't set directory dates
Ladislav
6-Oct-2010
[18624]
I suppose you mean Set-modes?
Graham
6-Oct-2010
[18625x2]
yes
Now that I think about it .. my NAS box has that problem .. I copy 
files to it, and the file dates are in the future because the box's 
time runs fast :(
Geomol
6-Oct-2010
[18627]
how to remove the last character from a file in R3?


I don't know, if it will be done differently in R3, but using R2 
I would do something like:

sz: length? p: open/binary %file
write/binary %newfile copy/part p sz - 1
close p
Ladislav
6-Oct-2010
[18628x2]
hmm, ugly
in R2 it can be simpler, but probably not in R3
Geomol
6-Oct-2010
[18630x2]
yeah! :-)
Is this better with your definition of 'ugly'?


write/binary %file copy/part read/binary %file (get in info? %file 
'size) - 1
Ladislav
6-Oct-2010
[18632]
- that is the same for me, I would like to just remove one character, 
not to copy the whole file
Geomol
6-Oct-2010
[18633]
Is that possible?
Ladislav
6-Oct-2010
[18634]
in R2 it is, as it looks
Geomol
6-Oct-2010
[18635x2]
I mean, is it possible in R2?
Could you show me?
Ladislav
6-Oct-2010
[18637]
port: open %file
remove back tail file
close port
Geomol
6-Oct-2010
[18638]
Neat! :)
Ladislav
6-Oct-2010
[18639]
remove back tail port is what I meant
Geomol
6-Oct-2010
[18640x2]
yes
And it doesn't work in R3 for some reason?
Ladislav
6-Oct-2010
[18642x2]
...at least not for me...
:-(
Geomol
6-Oct-2010
[18644x3]
Here (under windows) a unix format text file is changed to dos format, 
if I do, what you just suggested. So it become longer.
Doing open/binary and it works.
Using R3, I get:
** Script error: cannot use remove on port! value
Probably the same, you see.
ChristianE
6-Oct-2010
[18647]
Using R3, 

	>> clear back tail port

works for me.
Ladislav
6-Oct-2010
[18648x2]
aha, fine
thanks
Geomol
6-Oct-2010
[18650]
amazing!
ChristianE
6-Oct-2010
[18651]
That was just by luck.
Ladislav
6-Oct-2010
[18652x2]
Hmm, I thought, that OPEN does not create the file when it does not 
exist?
(in R2)
Pekr
6-Oct-2010
[18654]
in R2, you use open/new for such purpose (to create a file if it 
does not exist)
Ladislav
6-Oct-2010
[18655]
But, I need the exact opposite, to open touch a file only if it exists, 
which looks like not supported...
ChristianE
6-Oct-2010
[18656x2]
>> port: open/read %test

** Access Error: Cannot open /c/program files (x86)/rebol/view/test
** Near: port: open/read %test

isn't suited for your purpose, I guess.
Since if it exists, you'll have do do a second OPEN, the file may 
vanish in the meantime.
Ladislav
6-Oct-2010
[18658]
that is a problem, I need to touch the file, i.e. change the date, 
but, nevermind, I can make a work-around
ChristianE
6-Oct-2010
[18659]
*do do = to do