Get the name of the app from the file path (common by default)
@param filePath
@param defaultAppName
@returns {*}
972629
function getAppName(filePath, defaultAppName) {
    defaultAppName = defaultAppName || 'common';

    if (!filePath) { return defaultAppName; }
    var idx = filePath.indexOf(delim + 'app' + delim);
    if (idx < 0) { return defaultAppName; }

    filePath = filePath.substring(idx + 5);

    idx = filePath.indexOf(delim);
    return idx > 0 ? filePath.substring(0, idx) : filePath;
}
149285
protected static String getApplicationName(Context ctx) {
        try {
            ApplicationInfo applicationInfo = ctx.getApplicationInfo();
            int stringId = applicationInfo.labelRes;
            if (stringId == 0) {
                if (applicationInfo.nonLocalizedLabel != null) {
                    return applicationInfo.nonLocalizedLabel.toString();
                }
            } else {
                return ctx.getString(stringId);
            }
        } catch (Exception e) {
            Log.e(TAG, "Error getting application name.", e);
        }

        return null;
    }
824046
public static String getByFilename(String fileName, String defaultType) {
        String extn = getExtension(fileName);
        if (extn != null) {
            return get(extn, defaultType);
        } else {
            // no extension, no content type
            return null;
        }
    }
178258
function getFile(filepath) {
	var fileObj = {
			path: filepath,
			content: null
	};
    try {
        fs.accessSync(filepath, fs.F_OK);
    } catch(e) {
			console.log(e.message);
        return fileObj;
    }
		fileObj.content = fs.readFileSync(filepath, 'utf-8').trim();
		return fileObj;
}
355270
function reqToAppName(req) {
  var targetName = null;
  try {
    targetName = req.url.split('/').pop();
  } catch (e) {}
  return targetName || null;
}
639131
function getPath(pathname) {
    var _paths = { };
    _paths["app.home"] = path.join(process.env.HOME, ".docvy");
    _paths["app.cache"] = path.join(_paths["app.home"], "cache");
    _paths["app.cache.plugins"] = path.join(_paths["app.cache"], "plugins");
    _paths["app.logs"] = path.join(_paths["app.home"], "logs");
    _paths["app.plugins"] = path.join(_paths["app.home"], "plugins");
    var target = _paths[pathname] || null;
    if (target) {
        mkdirp.sync(target);
    }
    return target;
}
809192
function(appName) {
      var appDefaults = {
        name : null,
        task: {
          name: null,
          description: null
        },
        options: []
      };
      apps[appName] = appDefaults;
      apps[appName].name = appName;
    }
890337
function getorigPath(filePath, base) {
    var extName = path.extname(filePath);
    var pt = path.resolve(base, filePath);
    if (!extName) pt += '.js';
    return pt;
}
159728
function basename (filePath) {
  if (isWindows) {
    // Windows executables must have an extension, so strip it away
    return path.basename(filePath, path.extname(filePath))
  }
  return path.basename(filePath)
}
44016
public VDirectory createApplication(String appName) {
        Tenant tenant = new Tenant(TenantService.instance().getDefaultTenantDef());
        return createApplication(tenant, appName);
	}
425297
public static String getUserApplicationConfigurationFilePath(
		@NonNull final String applicationName, @NonNull final String configFileName)
	{
		return System.getProperty(USER_HOME_PROPERTY_KEY) + File.separator + applicationName
			+ File.separator + configFileName;
	}
56710
private Path getYarnFilesDir(final ApplicationId appId) throws IOException {
		final FileSystem fileSystem = FileSystem.get(yarnConfiguration);
		final Path homeDir = fileSystem.getHomeDirectory();
		return new Path(homeDir, ".flink/" + appId + '/');
	}
1194366
@Nonnull
    public static Path getApprovalPath(Path filePath) {
        Pre.notNull(filePath, "filePath");

        String s = filePath.toString();
        int extensionIndex = s.lastIndexOf('.');

        if (extensionIndex == -1) {
            return Paths.get(s + FOR_APPROVAL_EXTENSION);
        }

        int lastPartOfPath = s.lastIndexOf('/');
        if (lastPartOfPath != -1 && lastPartOfPath > extensionIndex) {
            //there was no extension and the directory contains dots.
            return Paths.get(s + FOR_APPROVAL_EXTENSION);
        }

        String firstPart = s.substring(0, extensionIndex);
        String extension = s.substring(extensionIndex);

        return Paths.get(firstPart + FOR_APPROVAL_EXTENSION + extension);

    }
1042491
def get_global_shelf_fpath(appname='default', ensure=False):
    
    global_cache_dir = get_global_cache_dir(appname, ensure=ensure)
    shelf_fpath = join(global_cache_dir, meta_util_constants.global_cache_fname)
    return shelf_fpath
959288
function(filepath) {
    var pieces = _.last(filepath.split('/')).split('.');
    var name   = _(pieces).without(_.last(pieces)).join('.'); // strips file extension
    if (name.charAt(0) === '_') {
      name = name.substr(1, name.length); // strips leading _ character
    }
    return name;
  }
220634
@Nonnull
    public static String getFileName(@Nonnull String filePath) {
        int idx = filePath.lastIndexOf('\\');
        if(idx>=0)
            return getFileName(filePath.substring(idx+1));
        idx = filePath.lastIndexOf('/');
        if(idx>=0)
            return getFileName(filePath.substring(idx+1));
        return filePath;
    }
714901
function extractBundleName(filePath) {
	const parts = filePath.replace(bundlesPath, '').split(path.sep);
	return parts[1];
}