Index: openacs.org-dev/packages/acs-content-repository/tcl/content-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/acs-content-repository/tcl/content-procs.tcl,v diff -u -N -r1.1.1.1 -r1.1.1.2 --- openacs.org-dev/packages/acs-content-repository/tcl/content-procs.tcl 9 Jul 2002 17:34:56 -0000 1.1.1.1 +++ openacs.org-dev/packages/acs-content-repository/tcl/content-procs.tcl 25 Jul 2002 18:46:44 -0000 1.1.1.2 @@ -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 }