protected function add_file_to_pool($pathname) {

        if (!is_readable($pathname)) {
            throw new moodle1_convert_exception('file_not_readable');
        }

        $contenthash = file_storage::hash_from_path($pathname);
        $filesize    = filesize($pathname);
        $hashpath    = $this->converter->get_workdir_path().'/files/'.substr($contenthash, 0, 2);
        $hashfile    = "$hashpath/$contenthash";

        if (file_exists($hashfile)) {
            if (filesize($hashfile) !== $filesize) {
                // congratulations! you have found two files with different size and the same
                // content hash. or, something were wrong (which is more likely)
                throw new moodle1_convert_exception('same_hash_different_size');
            }
            $newfile = false;

        } else {
            check_dir_exists($hashpath);
            $newfile = true;

            if (!copy($pathname, $hashfile)) {
                throw new moodle1_convert_exception('unable_to_copy_file');
            }

            if (filesize($hashfile) !== $filesize) {
                throw new moodle1_convert_exception('filesize_different_after_copy');
            }
        }

        return array($contenthash, $filesize, $newfile);
    }