Check that the DirectoryInfo object is correctly delimited by a BEGIN
 and END, that their profile values match, and if +profile+ is specified, that
 they are the specified profile.
190044
def check_begin_end(profile=nil) #:nodoc:
      unless @fields.first
        raise "No fields to check"
      end
      unless @fields.first.name? "BEGIN"
        raise "Needs BEGIN, found: #{@fields.first.encode nil}"
      end
      unless @fields.last.name? "END"
        raise "Needs END, found: #{@fields.last.encode nil}"
      end
      unless @fields.last.value? @fields.first.value
        raise "BEGIN/END mismatch: (#{@fields.first.value} != #{@fields.last.value}"
      end
      if profile
        if ! @fields.first.value? profile
          raise "Mismatched profile"
        end
      end
      true
    end
375555
function isDirectory(filePath) {
  if (!isExist(filePath)) return false;
  try {
    const stat = fs.statSync(filePath);
    return stat.isDirectory();
  } catch (e) {
    return false;
  }
}
367189
def _check_endings(self):
        """"""
        if self.slug.startswith("/") and self.slug.endswith("/"):
            raise InvalidSlugError(
                _("Invalid slug. Did you mean {}, without the leading and trailing slashes?".format(self.slug.strip("/"))))
        elif self.slug.startswith("/"):
            raise InvalidSlugError(
                _("Invalid slug. Did you mean {}, without the leading slash?".format(self.slug.strip("/"))))
        elif self.slug.endswith("/"):
            raise InvalidSlugError(
                _("Invalid slug. Did you mean {}, without the trailing slash?".format(self.slug.strip("/"))))
560863
def profile_dir(name):
    """"""
    if name:
        possible_path = Path(name)
        if possible_path.exists():
            return possible_path
    profiles = list(read_profiles())
    try:
        if name:
            profile = next(p for p in profiles if p.name == name)
        else:
            profile = next(p for p in profiles if p.default)
    except StopIteration:
        raise ProfileNotFoundError(name)
    return profile.path
58216
private boolean isDirectoryTraverse(StringBuffer path)
	{
			
		boolean directoryTraverse = false;
			
		String matchString = path.toString();
			
		//PM82876 Start
		if (WCCustomProperties.ALLOW_DOTS_IN_NAME) {
		    // The fileName can have .. , check for the failing conditions only.
		    if (matchString.indexOf("..") > -1) {
		        if( (matchString.indexOf("/../") > -1) || (matchString.indexOf("\\..\\") > -1) || 
		                        matchString.startsWith("../") || matchString.endsWith("/..") || 
		                        matchString.startsWith("..\\")|| matchString.endsWith("\\..")) 
		        {
		            directoryTraverse = true;
		            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
		                logger.logp(Level.FINE, CLASS_NAME, "isDirectoryTraverse", "bad path :" + matchString);
		        }
		    }    
		}
                else{//PM82876 End

                    /**
                     * Do not allow ".." to appear in a path as it allows one to serve files from anywhere within
                     * the file system.
                     * Also check to see if the path or URI ends with '/', '\', or '.' .
                     * PQ44346 - Allow files on DFS to be served.
                     */
                    if ( (matchString.lastIndexOf("..") != -1) && (!matchString.startsWith("/...") )) 
                    {
                        directoryTraverse = true;
                    }

                }
		if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
			logger.logp(Level.FINE, CLASS_NAME,"isDirectoryTraverse", "returning" + directoryTraverse + " , matchstring :" + matchString);
			
		return directoryTraverse;
	}
251642
static boolean checkWildCards(final SearchableString value, final Literal[] suffixes, final int start,
            final int end) {

        if (suffixes == null) {
            // No wildcards
            return start == end + 1;
        }

        // One wildcard
        if (suffixes.length == 0) {
            return start <= end + 1;
        }

        int from = start;
        for (final Literal suffix : suffixes) {

            final int match = checkWildCard(value, suffix, from);
            if (match == -1) {
                return false;
            }

            from = suffix.getLength() + match;
            if (from > end + 1) {
                return false;
            }
        }

        return true;
    }
1011848
function verifyProfile(profile, profileKey) {
    if (!profile.file && !profile.url) {
        throw new Error(`[${profileKey}] Must specify a file or url in the configuration.`);
    }
    if (!profile.output) {
        throw new Error(`[${profileKey}] Must specify an output file path in the configuration.`);
    }
    if (!profile.generator) {
        throw new Error(`[${profileKey}] Must specify a generator in the configuration.`);
    }
    if (profile.generator.toLowerCase() === 'core') {
        throw new Error(`[${profileKey}] Invalid generator ${profile.generator}. This name is reserved.`);
    }
    if (profile.generator.match(/^[\w-]+-language$/i)) {
        throw new Error(`[${profileKey}] Invalid generator ${profile.generator}. The -language suffix is reserved for language helper packages.`);
    }
    profile.debug = profile.debug || {};
    profile.filters = profile.filters || {};
    profile.transforms = profile.transforms || {};
    profile.options = profile.options || {};
}
1077061
def validate_name(ctx, param, value):
    """"""
    if not value:
        value = os.path.basename(ctx.params['directory'].rstrip(os.path.sep))
    return value
27252
function profile(target, propertyKey, descriptor) {
    if (flags_1.IS_PROFILE) {
        return performProfile(target, propertyKey, descriptor);
    }
    else {
        // return as-is
        return descriptor;
    }
}
191709
private static int checkWildCard(final SearchableString value, final Literal suffix, final int start) {
        for (final int index : value.getIndices(suffix)) {
            if (index >= start) {
                return index;
            }
        }
        return -1;
    }
156704
public boolean match(String rootPath, CmsLock lock) {

        boolean match = false;
        if (m_includeChildren) {
            // safe since rootPath always ends with slash if a folder
            match = lock.getResourceName().startsWith(rootPath);
        }
        if (!match && m_includeParents) {
            // since parents can only be folders, check it only for folders
            if (lock.getResourceName().endsWith("/")) {
                match = rootPath.startsWith(lock.getResourceName());
            }
        }
        if (match && (m_projectId != null) && !m_projectId.isNullUUID() && (lock.getProjectId() != null)) {
            match = lock.getProjectId().equals(m_projectId);
        }
        if (match && (m_ownedByUserId != null) && !m_ownedByUserId.isNullUUID()) {
            match = lock.getUserId().equals(m_ownedByUserId);
        }
        if (match && (m_notOwnedByUserId != null) && !m_notOwnedByUserId.isNullUUID()) {
            match = !lock.getUserId().equals(m_notOwnedByUserId);
        }
        if (match && (m_lockableByUser != null)) {
            match = lock.isLockableBy(m_lockableByUser);
        }
        if (match && (m_notLockableByUser != null)) {
            match = !lock.isLockableBy(m_notLockableByUser);
        }
        if (match && !m_types.isEmpty()) {
            match = m_types.contains(lock.getType());
            match = match || (m_includeParents && lock.isInherited());
        }
        // check the related lock if available
        if (!match && !lock.getRelatedLock().isNullLock()) {
            match = match(rootPath, lock.getRelatedLock());
        }
        return match;
    }
707362
function prepareProfileDir(profilesDir, nick) {
  var nick = nick || '.tmp';
  // Just in case `nick` has any funny business...
  nick = nick.replace(/[^\w\d.]/g, '-').replace('..', '-');
  var profileDir = path.join(profilesDir, util.format('vox-%s', nick));
  debug('Ensuring directory at %s', profileDir);
  mkdirp.sync(profileDir, 0700);
  return profileDir;
}
865190
def dir_param_valid(d):
    ''''''
    r = True
    if not isinstance(d, str) :
        r = False
        raise TypeError
    if not os.path.isdir(d):
        r = False
        raise ValueError
    return r
931482
def endswith(self, suffix, start=None, end=None):
        
        suffix = Bits(suffix)
        start, end = self._validate_slice(start, end)
        if start + suffix.len > end:
            return False
        start = end - suffix.len
        return self._slice(start, end) == suffix
808151
private boolean isProfileActive(String profile) {
        validateProfile(profile);
        Set<String> currentActiveProfiles = doGetActiveProfiles();
        return (currentActiveProfiles.contains(profile) ||
                (currentActiveProfiles.isEmpty() && doGetDefaultProfiles().contains(profile)));
    }
480329
def valid_directory?(entry)
      File.directory?(source.join(entry)) && !IGNORE_DIR.include?(File.basename(entry))
    end
347707
def contains_glob(path_to_directory, pattern, wanted=None):
    """"""
    if not path_to_directory:
        return False
    needed = make_needed(pattern, path_to_directory, wanted)
    for name in _names_in_directory(path_to_directory):
        if needed(name):
            return True
    return False