Returns AppDir instance for given subdirectory name.
965229
def sub(self, path):
        """"""

        if is_collection(path):
            path = path_join(path)

        return AppDir(path_join(self.path, path))
764916
def angularFrontendAppDir(self) -> str:
        
        relDir = self._packageCfg.config.plugin.title(require_string)
        dir = os.path.join(self._pluginRoot, relDir)
        if not os.path.isdir(dir): raise NotADirectoryError(dir)
        return dir
299906
def get_profile_dir ():
    """"""
    if os.name == 'nt':
        if "LOCALAPPDATA" in os.environ:
            basedir = unicode(os.environ["LOCALAPPDATA"], nt_filename_encoding)
        else:
            # read local appdata directory from registry
            from ..winutil import get_shell_folder
            try:
                basedir = get_shell_folder("Local AppData")
            except EnvironmentError:
                basedir = os.path.join(os.environ["USERPROFILE"], "Local Settings", "Application Data")
        dirpath = os.path.join(basedir, u"Google", u"Chrome", u"User Data")
    elif os.name == 'posix':
        basedir = unicode(os.environ["HOME"])
        if sys.platform == 'darwin':
            dirpath = os.path.join(basedir, u"Library", u"Application Support")
        else:
            dirpath = os.path.join(basedir, u".config")
        dirpath = os.path.join(dirpath, u"Google", u"Chrome")
    return dirpath
1070930
def change_dir(self, to, after_app_loading=False):
        
        self._set('chdir2' if after_app_loading else 'chdir', to)

        return self._section
814732
def user_cache_dir(self):
        """"""
        directory = appdirs.user_cache_dir(self.appname, self.appauthor,
                              version=self.version)
        if self.create:
            self._ensure_directory_exists(directory)
        return directory
1147451
def get_storage(key, username):
    """"""
    if IS_APPENGINE and appengine:
        return appengine.StorageByKeyName(
            appengine.CredentialsModel, username, 'credentials')
    file_name = os.path.expanduser('~/.config/webreview/{}_{}'.format(key, username))
    dir_name = os.path.dirname(file_name)
    if not os.path.exists(dir_name):
        os.makedirs(dir_name)
    return oauth_file.Storage(file_name)
64511
def get_app_dir(app):
    
    path = __app_dirs__.get(app)
    if path is not None:
        return path
    else:
        p = app.split('.')
        try:
            path = pkg.resource_filename(p[0], '')
        except ImportError as e:
            log.error("Can't import app %s" % app)
            log.exception(e)
            path = ''
        if len(p) > 1:
            path = os.path.join(path, *p[1:])
        
        __app_dirs__[app] = path
        return path
757251
def _get_program_dir(name, config):
    
    if config is None:
        raise ValueError("Could not find directory in config for %s" % name)
    elif isinstance(config, six.string_types):
        return config
    elif "dir" in config:
        return expand_path(config["dir"])
    else:
        raise ValueError("Could not find directory in config for %s" % name)
44016
public VDirectory createApplication(String appName) {
        Tenant tenant = new Tenant(TenantService.instance().getDefaultTenantDef());
        return createApplication(tenant, appName);
	}
203512
def _get_subfolder(self, foldername, returntype,
                       params=None, file_data=None):
        """"""
        newurl = compat.urljoin(self.url, compat.quote(foldername), False)

        params = params or {}
        file_data = file_data or {}

        # Add the key-value pairs sent in params to query string if they
        # are so defined.
        query_dict = {}
        url_tuple = compat.urlsplit(newurl)
        urllist = list(url_tuple)

        if params:
            # As above, pull out first element from parse_qs' values
            query_dict = dict((k, v[0]) for k, v in 
                               cgi.parse_qs(urllist[3]).items())
            for key, val in params.items():
                # Lowercase bool string
                if isinstance(val, bool):
                    query_dict[key] = str(val).lower()
                # Special case: convert an envelope to .bbox in the bb
                # parameter
                elif isinstance(val, geometry.Envelope):
                    query_dict[key] = val.bbox
                # Another special case: strings can't be quoted/escaped at the
                # top level
                elif isinstance(val, gptypes.GPString):
                    query_dict[key] = val.value
                # Just use the wkid of SpatialReferences
                elif isinstance(val, geometry.SpatialReference): 
                    query_dict[key] = val.wkid
                # If it's a list, make it a comma-separated string
                elif isinstance(val, (list, tuple, set)):
                    val = ",".join([str(v.id) 
                                    if isinstance(v, Layer)
                                    else str(v) for v in val])
                # If it's a dictionary, dump as JSON
                elif isinstance(val, dict):
                    val = json.dumps(val)
                # Ignore null values, and coerce string values (hopefully
                # everything sent in to a query has a sane __str__)
                elif val is not None:
                    query_dict[key] = str(val)
        if self.__token__ is not None:
            query_dict['token'] = self.__token__
        query_dict[REQUEST_REFERER_MAGIC_NAME] = self._referer or self.url
        # Replace URL query component with newly altered component
        urllist[3] = compat.urlencode(query_dict)
        newurl = urllist
        # Instantiate new RestURL or subclass
        rt = returntype(newurl, file_data)
        # Remind the resource where it came from
        try:
            rt.parent = self
        except:
            rt._parent = self
        return rt
1374520
def directory(self, query, **kwargs):
        """"""
        if isinstance(query, dict):
            query = str(query).replace("'", '"')

        return self.__call_api_get('directory', query=query, kwargs=kwargs)
1332666
function initAppDir (config, module, appDir, appSubDir) {
    // if called without sub dir then start with app dir
    if (!appSubDir) {
        appSubDir = appDir
    }
    // debug
    debug('initAppDir %s', appSubDir)
    // get relative path from app base to directory which determines
    // where in the routes tree this directory sits
    var rel = path.relative(appDir, appSubDir)
    // get route node from relative path
    var route = routeFromRel(module.routes, rel)
    // prevent infinite loops
    if (route.loaded) {
        return
    }
    // mark route as loaded
    route.loaded = true
    // directory names map
    var dirNames = {}
    // list of all sub-directories in directory
    var dirs = []
    // list of all files in directory
    var files = []
    // iterate over file names in directory
    _.each(fs.readdirSync(appSubDir), file => {
        // get absolute file
        var absFile = appSubDir+'/'+file
        // get stat of file to check if it is dir or file
        var stat = fs.statSync(absFile)
        // file
        if (stat.isFile()) {
            files.push(absFile)
        }
        // directory
        else if (stat.isDirectory()) {
            // add name to map for doing conflict checking
            dirNames[file] = true
            // add abs path to list for recursive loading
            dirs.push(absFile)
        }
        // ignore anything else
        else {
            debug('initAppDir: ignoring %s', absFile)
        }
    })
    // recursively process all sub-directories - go depth first so that routes
    // for sub-dirs are added before wildcard path param matching rules
    _.each(dirs, dir => {
        initAppDir(config, module, appDir, dir)
    })
    // regular expression for matching controller files
    var controllerRegEx = /controller\.js$/
    // regular expression for matching model files
    var modelRegEx = /model\.js$/
    // regular expression for matching template files extname starts with .
    config.handlebars.templateRegExp = new RegExp('\\'+config.handlebars.ext+'$')
    // ImmutableCoreController for node - multiple files will be merged
    route.controller = {}
    // ImmutableCoreModel for node - multiple files will be merged
    route.model = {}
    // list of templates indexed by name. name of template file indicates path
    // that it should be served on. if path does not have a controller then
    // a default controller will be created.
    route.templates = {}
    // get mapping of templates by path
    route.templatesInverse = {}
    // require all controller and model files for route
    _.each(files, file => {
        // get type
        var type
        // controllers must be named controller.js
        if (file.match(controllerRegEx)) {
            // require controller file
            var controller = require(path.relative(__dirname, file))
            // require defined
            assert.ok(defined(controller), `nothing exported for ${file}`)
            // throw error if controller instantiated
            assert.ok(!controller.ImmutableCoreController, `controller must be plain object ${file}`)
            // merge controller spec
            _.merge(route.controller, controller)
        }
        // models must be named model.js
        else if (file.match(modelRegEx)) {
            // require model file
            var model = require(path.relative(__dirname, file))
            // require defined
            assert.ok(defined(model), `nothing exported for ${file}`)
            // throw error if controller instantiated
            assert.ok(!model.ImmutableCoreModel, `model must be plain object ${file}`)
            // merge model spec
            _.merge(route.model, model)
        }
        // template files must end in hbs
        else if (file.match(config.handlebars.templateRegExp)) {
            // get only the file name
            file = path.basename(file)
            // remove extension from file
            file = file.replace(config.handlebars.templateRegExp, '')
            // template path used in render call is relative path from app
            // base (if any) and the file name without the extensions
            var templatePath = (rel.length ? rel+'/' : '') + file
            // split file name on dot - if template name has a dot then the
            // part after the dot must be the role that the template is for
            var fileParts = file.split('.')
            // if there is only a single part then not a role specific template
            if (fileParts.length === 1) {
                // if entry does not exist for template name then create it
                if (!defined(route.templates[file])) {
                    route.templates[file] = {
                        role: {},
                    }
                }
                // store template name and template path under default all role
                route.templates[file].role.all = templatePath
                // create inverse entry keyed by full path
                route.templatesInverse[templatePath] = {
                    name: file,
                    role: 'all',
                }
            }
            // it there are two parts they must be name.role
            else if (fileParts.length === 2) {
                var name = fileParts[0]
                var role = fileParts[1]
                // if entry does not exist for template name then create it
                if (!defined(route.templates[name])) {
                    route.templates[name] = {
                        role: {},
                    }
                }
                // store template name and template path
                route.templates[name].role[role] = templatePath
                // create inverse entry keyed by full path
                route.templatesInverse[templatePath] = {
                    name: name,
                    role: role,
                }
            }
            // if there are not 1 or 2 parts this is an error
            else {
                throw new Error('invalid template file name '+file)
            }
        }
        // otherwise ignore file
        else {
            return
        }
    })
    // if controller name is not set construct from module name
    if (!defined(route.controller.name)) {
        // get controller name as app + path
        route.controller.name = changeCase.camelCase(module.name)
            + changeCase.pascalCase(rel.length ? rel : 'Index')
    }
    // if controller path is not set use current relative path
    if (!defined(route.controller.path)) {
        route.controller.path = rel
    }
}
697188
def find(self, name, limit=None):
        """"""
        if name == self.name:
            if limit is not None:
                assert limit == 1
                self.subdirs = []
            return self
        for subdir in self.subdirs:
            res = subdir.find(name, limit)
            if res is not None:
                return res
        return None
1136299
function resolveApp(dir) {
  if (path.isAbsolute(dir)) return dir;
  return path.join(process.cwd(), dir);
}
1294870
def select_directory(self):
        """"""
        self.__redirect_stdio_emit(False)
        directory = getexistingdirectory(
                self, _(""), self.path)
        if directory:
            directory = to_unicode_from_fs(osp.abspath(directory))
        self.__redirect_stdio_emit(True)
        return directory
783762
def _get_app_path(url):
    ''' 

    '''
    app_path = urlparse(url).path.rstrip("/")
    if not app_path.startswith("/"):
        app_path = "/" + app_path
    return app_path
416182
def get_dir(self, objtxt):
        """"""
        obj, valid = self._eval(objtxt)
        if valid:
            return getobjdir(obj)