Get the name of the layout to use.
@param  {Object} `file`
@param  {Object} `options`
@return {String|Null} Returns the name of the layout to use or `false`
432600
function getLayoutName(file, options) {
  const defaultLayout = options.defaultLayout;
  const prop = options.layoutProp || 'layout';
  const name = file[prop];
  if (typeof name === 'undefined' || name === true || name === defaultLayout) {
    return defaultLayout;
  }
  if (!name || ['false', 'null', 'nil', 'none', 'undefined'].includes(name.toLowerCase())) {
    return false;
  }
  return name;
}
821442
function(options){
			var children  = (docMap[config.parent].children || []);
			for(var i = 0 ; i < children.length; i++){
				if(children[i].name == this.name){
					return options.fn(this);
				}
			}
			return "";
		}
490893
function loadLayouts (options) {
    // return cached layouts if caching enabled
    if (options.cache && GLOBAL.layouts) {
        return GLOBAL.layouts
    }
    // load layouts
    GLOBAL.layouts = loadTemplates(GLOBAL.layoutDirs, options)
    // return promise that will be resolved with layouts
    return GLOBAL.layouts
}
996899
function getFilename(id, options, next) {
	var Path = require('path'),
		root = options.root || exports.defaults.root,
		map = options.map || {},
		forbid = (options.forbid || []).map(function(forbid) {
			return forbid.test ? forbid : Path.resolve(root, forbid);
		}),
		filename;

	function test(forbid) {
		return forbid.test ? forbid.test(filename) :
			(filename.slice(0, forbid.length) === forbid); // filename starts with forbid
	}

	// mapped modules can be in forbidden places. (define and define.shim should be mapped)
	map.define = map.define || Path.resolve(__dirname, 'define');
	map['define.min'] = map['define.min'] || Path.resolve(__dirname, 'define.min');
	map['define.shim'] = map['define.shim'] || Path.resolve(__dirname, 'define.shim');

	// get a filename from the id
	filename = map[id] || id; // look for the file in the id map
	if ('function' === typeof filename) { filename = filename(id, options); } // if function use result
	filename = Path.resolve(root, filename); // relative to root

	if (!map[id]) {
		// anything below options.root is forbidden
		if ('..' === Path.relative(root, filename).slice(0, 2) || forbid.some(test)) {
			return next(new Error('Forbidden'), '');
		}
	}

	fs.stat(filename, function(err, stats) {
		if (err) { // not found without .js, try with
			return fs.exists(filename + '.js', function(exists) {
				return next(null, filename + (exists ? '.js' : ''));
			});
		}

		if (stats.isDirectory()) { // directories look for /index.js
			return fs.exists(filename + '/index.js', function(exists) {
				return next(null, filename + (exists ? '/index.js' : ''));
			});
		}

		return next(null, filename);
	});
}
791212
function getPartials(file, sourcePath, templates, customPartialName, callback) {
  const { partials } = templates;
  if (file.meta.customLayout === undefined) {
    async.nextTick(callback, null, partials);
    return;
  }

  const customLayoutPath = path.join(
    sourcePath,
    path.resolve(path.sep, file.meta.filePath.dir, file.meta.customLayout)
  );
  read(customLayoutPath, ReadMode.UTF8, (error, data) => {
    if (error) {
      console.error(`${file.path}: Could not load the custom layout`);
      async.nextTick(callback, error);
      return;
    }

    const customPartials = { [customPartialName]: data };
    async.nextTick(callback, null, Object.assign({}, partials, customPartials));
  });
}
943647
function (filePath) {
        var name = ES6ModuleFile.prototype.getModuleName.apply(this, arguments);

        if (_.isFunction(this.opts.moduleName)) {
            name = this.opts.moduleName(name, filePath);
        }

        return name;
    }
816810
public static String basename(File file)
  {
    if(file == null) {
      return null;
    }
    String fileName = file.getName();
    int i = fileName.lastIndexOf('.');
    return i != -1 ? fileName.substring(0, i) : fileName;
  }
760362
function resolveLayout(file, layout, options, regex, name) {
  if (typeOf(layout.contents) !== 'buffer') {
    throw new Error('expected layout.contents to be a buffer');
  }

  // reset lastIndex, since regex is cached
  regex.lastIndex = 0;

  const layoutString = toString(layout, options);
  if (!regex.test(layoutString)) {
    throw new Error(`cannot find tag "${regex.source}" in layout "${name}"`);
  }

  const fileString = toString(file, options);
  let str;

  if (options.preserveWhitespace === true) {
    const re = new RegExp('(?:^(\\s+))?' + regex.source, 'gm');
    let lines;

    str = layoutString.replace(re, function(m, whitespace) {
      if (whitespace) {
        lines = lines || fileString.split('\n'); // only split once, JIT
        return lines.map(line => whitespace + line).join('\n');
      }
      return fileString;
    });

  } else {
    str = Buffer.from(layoutString.replace(regex, () => fileString));
  }

  file.contents = Buffer.from(str);
  return getLayoutName(layout, options);
}
534228
@Override
	public String name() {

		if (file == null) {
			return null;
		}

		String name = null;

		try (Tx tx = StructrApp.getInstance(securityContext).tx()) {

			name = file.getName();
			tx.success();

		} catch (FrameworkException fex) {
			logger.error("", fex);
		}

		return name;
	}
934406
public String getExtension(final File file) {
		if (file != null) {
			final String fileName = file.getName();
			final int i = fileName.lastIndexOf('.');
			if (i > 0 && i < fileName.length() - 1) {
				return fileName.substring(i + 1).toLowerCase(Locale.getDefault());
			}
		}
		return null;
	}
1092579
function layoutDimensions(options) {
    options = getLayoutDimensionOptions(options);

    if (options.nodeDimensionsIncludeLabels) {
      var bbDim = this.boundingBox();
      return {
        w: bbDim.w,
        h: bbDim.h
      };
    } else {
      return {
        w: this.outerWidth(),
        h: this.outerHeight()
      };
    }
  }
840157
public static String getOwnerName(final File file) {
        try {
            final Path path = Paths.get(file.getAbsolutePath());
            final FileOwnerAttributeView ownerAttributeView = Files.getFileAttributeView(path, FileOwnerAttributeView.class);
            return ownerAttributeView != null ? ownerAttributeView.getOwner().getName() : null;
        }
        catch(Exception e) {
            logger.warn("Failed to determine 'owner' of {}: {}", file, e.getMessage());
            return null;
        }
    }
1007009
function(fileURL, newF){
			var fileName;
			if(this.options && this.options.newFileName && this.options.oldFileName) {
				fileName = newF ? this.options.newFileName : this.options.oldFileName;
			} else {
				fileName = fileURL.split("?")[0]; //$NON-NLS-0$
			}
			return fileName;
		}
311259
function layoutResource(filePath, config) {

    filePath = filePath || this.page.template;
    var testFilePath = filePath + config.extOut;
    var stat = this.has_file(testFilePath);

    if (stat) {
      return filePath;
    }

  }
1251179
function getThemeByFile(file) {
        var path = file._path;
        return _.find(loadedThemes, function (item) {
            return item.file._path === path;
        });
    }
41688
public static String mainName(File file) {
		if (file.isDirectory()) {
			return file.getName();
		}
		return mainName(file.getName());
	}
1340201
function(file, options) {
		file = this.absPath(file);
		var cwd = (options && options.cwd) || '';
		if (file.substring(0, cwd.length) == cwd) {
			file = file.substring(cwd.length);
			if (file.charAt(0) != '/') {
				file = '/' + file;
			}
		}

		return file;
	}