public function resolveFile($file, $filename)
    {
        // remove this and use the static class constant File::separator
        // as soon as ZE2 is ready
        $fs = FileSystem::getFileSystem();

        $filename = str_replace(array('\\', '/'), $fs->getSeparator(), $filename);

        // deal with absolute files
        if (StringHelper::startsWith($fs->getSeparator(), $filename)
            || (strlen($filename) >= 2 && Character::isLetter($filename{0}) && $filename{1} === ':')
        ) {
            return new PhingFile($this->normalize($filename));
        }

        if (strlen($filename) >= 2 && Character::isLetter($filename{0}) && $filename{1} === ':') {
            return new PhingFile($this->normalize($filename));
        }

        $helpFile = new PhingFile($file->getAbsolutePath());

        $tok = strtok($filename, $fs->getSeparator());
        while ($tok !== false) {
            $part = $tok;
            if ($part === '..') {
                $parentFile = $helpFile->getParent();
                if ($parentFile === null) {
                    $msg = "The file or path you specified ($filename) is invalid relative to " . $file->getPath();
                    throw new IOException($msg);
                }
                $helpFile = new PhingFile($parentFile);
            } else {
                if ($part === '.') {
                    // Do nothing here
                } else {
                    $helpFile = new PhingFile($helpFile, $part);
                }
            }
            $tok = strtok($fs->getSeparator());
        }

        return new PhingFile($helpFile->getAbsolutePath());
    }