Switch to edit mode.
Name(s): _rename_file1: "Rename a file. Called by @rename."
2: set_task_perms(caller_perms())
3: {object, fname, iobjstr} = args
4: if (iobjstr[1] == "!")
5: iobjstr = iobjstr[2..$]
6: elseif (to = $code_utils:parse_fileref(iobjstr))
7: if (object == player:my_match_object(to[1]))
8: "The specified target object was the source."
9: iobjstr = to[2]
10: else
11: "This is really a @move, not a @rename"
12: return this:_move_file(@args)
13: endif
14: endif
15: e = `object:filerename(fname, iobjstr) ! ANY'
16: if (e == E_INVIND)
17: player:tell("Renaming ", object, "!", fname, " --> File not found")
18: elseif (e == E_INVARG)
19: player:tell("Renaming ", object, "!", fname, " --> File already exists with that name")
20: elseif (typeof(e) == $ERR)
21: player:tell("Renaming ", object, "!", fname, " --> ", e)
22: else
23: player:tell(object, "!", fname, " renamed to !", iobjstr)
24: endif
25: "Last modified by Dax (#789) on Tue May 3 13:45:55 2005 MDT."