Index: openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl,v diff -u -N -r1.50.2.1 -r1.50.2.2 --- openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 10 Mar 2019 22:04:51 -0000 1.50.2.1 +++ openacs-4/packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl 13 Jul 2020 12:02:33 -0000 1.50.2.2 @@ -76,7 +76,7 @@ } else { set components_lesser $components } - set extension [file extension $path] + set extension [ad_file extension $path] set type "" @@ -94,7 +94,7 @@ if {$extension eq ".sql"} { if { [lsearch -glob $components "*upgrade-*-*"] >= 0 } { set type "data_model_upgrade" - } elseif { [regexp -- "^$package_key-(create|drop)\.sql\$" [file tail $path] "" kind] } { + } elseif { [regexp -- "^$package_key-(create|drop)\.sql\$" [ad_file tail $path] "" kind] } { set type "data_model_$kind" } else { set type "data_model" @@ -133,7 +133,7 @@ set type "include_page" } elseif { $extension eq ".tcl" && [lindex $components_lesser 0] eq "tcl" } { # A .tcl file residing under dir .../package_key/tcl/ - if { [regexp -- {-(procs|init)(-[0-9a-zA-Z]*)?\.tcl$} [file tail $path] "" kind] } { + if { [regexp -- {-(procs|init)(-[0-9a-zA-Z]*)?\.tcl$} [ad_file tail $path] "" kind] } { if {[lindex $components end-1] eq "test"} { set type "test_$kind" } else { @@ -190,7 +190,9 @@ if {$all_p} { set file_function "" } else { - set file_function [expr {$include_data_model_files_p ? "apm_include_data_model_file_p" : "apm_include_file_p"}] + set file_function [expr {$include_data_model_files_p + ? "apm_include_data_model_file_p" + : "apm_include_file_p"}] } set files [lsort [ad_find_all_files -check_file_func $file_function $package_path]] # We don't assume db_type proc is defined yet @@ -249,8 +251,9 @@ } ad_proc -public apm_is_catalog_file { file_path } { - Given a file path return 1 if - the path represents a message catalog file and 0 otherwise. + + Given a file path return 1 if the path represents a message + catalog file and 0 otherwise. @param file_path Should be absolute or relative to OpenACS /packages dir or one of its parent dirs. @@ -303,7 +306,7 @@ 2. Other files. - If it is a tcl, xql, or sqlj file not under the sql dir and whose name + If it is a .tcl, .xql, or .sqlj file not under the "sql" dir and whose name ends in a dash and database type, the file is assumed to be specific to that database type. @@ -330,8 +333,8 @@ } return "oracle" } - - set file_name [file tail $path] + + set file_name [ad_file tail $path] foreach known_database_type $::acs::known_database_types { if { [regexp -- "\-[lindex $known_database_type 0]\.(xql|tcl|sqlj)\$" $file_name match] } { return [lindex $known_database_type 0] @@ -357,7 +360,7 @@ # We need to add that information back into the .info files. set package_path [acs_package_root_dir $package_key] - return [expr {![file exists "${package_path}/sql"] || [file exists "${package_path}/sql/[db_type]"]}] + return [expr {![ad_file exists "${package_path}/sql"] || [ad_file exists "${package_path}/sql/[db_type]"]}] } ad_proc -public apm_source { __file {errorVarName ""}} { @@ -371,7 +374,7 @@ array set errors [list] } - if { ![file exists $__file] } { + if { ![ad_file exists $__file] } { ns_log "Error" "Unable to source $__file: file does not exist." return 0 } @@ -388,7 +391,7 @@ return 0 } - nsv_set apm_library_mtime $r_file [file mtime $__file] + nsv_set apm_library_mtime $r_file [ad_file mtime $__file] return 1 } @@ -398,7 +401,7 @@ ad_proc -private apm_bootstrap_load_file { root_directory file {errorVarName ""}} { Source a single file during initial bootstrapping and set APM data. } { - ns_log "Notice" "Loading [file tail $root_directory]/$file" + ns_log "Notice" "Loading [ad_file tail $root_directory]/$file" if {$errorVarName ne ""} {upvar $errorVarName errors} apm_source ${root_directory}/${file} errors } @@ -493,7 +496,7 @@ } { set fn [apm_install_xml_file_path] # Abort if there is no install.xml file - if { ![file exists $fn] } { + if { ![ad_file exists $fn] } { return "" } @@ -522,11 +525,11 @@ Currently, a file is ignored if it is a backup file or a CVS directory. } { - if {[file isdirectory $path]} { + if {[ad_file isdirectory $path]} { # # ignored directories # - set parts [file split $path] + set parts [ad_file split $path] if {[lindex $parts end] eq "resources" && [lindex $parts end-1] eq "www"} { return 1 } @@ -547,11 +550,14 @@ if {!$data_model_files_p} { lappend extension_list ".sql" } - if {[file extension $path] in $extension_list} { + if {[ad_file extension $path] in $extension_list} { return 1 } - - if { [apm_backup_file_p [file tail $path]] } { + + if { [string index $path 0] eq "~"} { + set path ./$path + } + if { [apm_backup_file_p [ad_file tail $path]] } { return 1 } @@ -560,8 +566,8 @@ ad_proc -private apm_backup_file_p { path } { - Returns 1 if $path is a backup file, or 0 if not. We consider it a backup file if - any of the following apply: + Returns 1 if $path is a backup file, or 0 if not. We consider it a + backup file if any of the following apply: