apm_parse_catalog_path (public)

 apm_parse_catalog_path file_path

Defined in packages/acs-bootstrap-installer/tcl/30-apm-load-procs.tcl

Given the path of a file attempt to extract package_key, prefix, charset and locale information from the path assuming the path is on valid format for a message catalog file. If the parsing fails then the file is not considered a catalog file and the empty list is returned.

Parameters:
file_path (required)
Path of file, relative to the OpenACS /packages dir, one of its parent directories, or absolute path.
Author:
Peter Marklund

Partial Call Graph (max 5 caller/called nodes):
%3 test_apm_parse_catalog_path apm_parse_catalog_path (test acs-bootstrap-installer) apm_parse_catalog_path apm_parse_catalog_path test_apm_parse_catalog_path->apm_parse_catalog_path apm_is_catalog_file apm_is_catalog_file (public) apm_is_catalog_file->apm_parse_catalog_path lang::catalog::export_to_file lang::catalog::export_to_file (private) lang::catalog::export_to_file->apm_parse_catalog_path lang::catalog::import_from_file lang::catalog::import_from_file (private) lang::catalog::import_from_file->apm_parse_catalog_path lang::catalog::is_upgrade_backup_file lang::catalog::is_upgrade_backup_file (private) lang::catalog::is_upgrade_backup_file->apm_parse_catalog_path

Testcases:
apm_parse_catalog_path
Source code:
    array set filename_info {}

    # Catalog filepaths are on the form
    # package_key/catalog/optional_prefix_package_key.language.country.charset.xml
    set regexp_pattern "(?i)(\[^/\]+)/catalog/(.*)\\1\\.(\[a-z\]{2,3}_\[a-z\]{2})\\.(\[^.\]+)\\.xml\$"
    if { ![regexp $regexp_pattern $file_path match package_key prefix locale charset] } {
        return [list]
    }

    set filename_info(package_key) $package_key
    set filename_info(prefix) $prefix
    set filename_info(locale) $locale
    set filename_info(charset) $charset

    return [array get filename_info]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: