# ------------------------------------------------------------ # Copyright (c) 2003-2021 # Q.W.Page Associates Inc. # www.qwpage.com # All rights reserved. # ------------------------------------------------------------ ::namespace eval ::qw::ifs {} ::namespace eval ::qw::ifs::statistics {} ::proc ::qw::ifs::statistics::indexes_format {} { ::set SortedNames [::lsort [::array names ::qw::ifs::statistics::indexes]]; ::set Result ""; ::foreach Name $SortedNames { # ::append Result "$::qw::ifs::statistics::indexes($Name)\n"; ::append Result [::sargs::format .structure $::qw::ifs::statistics::indexes($Name)]; ::append Result "\n"; } return $Result; } ::proc ::qw::ifs::hostfile_open_check {sargs} { ::set DatabasePath [::sargs::get $sargs .database_path]; ::if {$DatabasePath eq ""} { ::qw::throw "The file was not specified."; } ::if {![::file exists $DatabasePath]} { ::qw::throw "Could not find file \"$DatabasePath\"."; } ::if {[::file isdirectory $DatabasePath]} { ::qw::throw "Expected \"$DatabasePath\" to be a file but it is a folder."; } ::if {![::file isfile $DatabasePath]} { ::qw::throw "\"$DatabasePath\" is not a file."; } /* { The following check caused problems on some computers so it was removed. #2.37.0 ::if {[::file executable $ScriptPath]} { ::qw::throw "\"$ScriptPath\" is an executable file."; } */ } /* { nvreorganize uses a different file type. Backup does also. We really don't care what the file type is as long as the file explorer only looks for .nv2. ::set Extension [::file extension $DatabasePath]; ::if {$Extension ne ".nv2"} { ::qw::throw [::sargs \ .text "Expected file type \".nv2\" but encountered \"$Extension\"." \ ]; } */ } ::if {![::file readable $DatabasePath]} { ::qw::throw "File \"$DatabasePath\" is not readable by the current user."; } #import.qw_script ::if {![::file writable $Path]} {::qw::throw "[::set ::tcl_platform(os)] file \"$Path\" is not writable by the current user.";} ::if {$::tcl_platform(platform)=="windows"} { ::array set Attributes [::file attributes $DatabasePath]; ::if {$Attributes(-system)} { ::qw::throw "\"$DatabasePath\" is a system file."; } #import.qw_script ::if {$Attributes(-readonly)} {::qw::throw "\"$Path\" is a read only [::set ::tcl_platform(os)] file.";} } }