Index: openacs-4/packages/acs-content-repository/tcl/content-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/content-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-content-repository/tcl/content-procs.tcl 26 Sep 2001 12:09:27 -0000 1.5 +++ openacs-4/packages/acs-content-repository/tcl/content-procs.tcl 10 Jul 2002 15:13:25 -0000 1.6 @@ -56,23 +56,33 @@ # lifted from new-file-storage (DanW - OpenACS) -ad_proc -public cr_create_content_file {item_id revision_id client_filename} { - +ad_proc -public cr_create_content_file { + -move:boolean + item_id + revision_id + client_filename +} { Copies the file passed by client_filename to the content repository file storage area, and it returns the relative file path from the root of the content repository file storage area.. + if the -move flag is given the file is renamed instead } { - set content_file [cr_create_content_file_path $item_id $revision_id] - set ifp [open $client_filename r] - set ofp [open [cr_fs_path]$content_file w] + if { $move_p } { + file rename -- $client_filename [cr_fs_path]$content_file + } else { + # JCD: not sure why ns_cpfp is used. tcl file copy is better + # since it is smarter about buffer sizes. + set ifp [open $client_filename r] + set ofp [open [cr_fs_path]$content_file w] + + ns_cpfp $ifp $ofp + close $ifp + close $ofp + } - ns_cpfp $ifp $ofp - close $ifp - close $ofp - return $content_file }