Determine whether the current file is an svg file

@param  {String} file
@param  {String} dirPath
@return {Boolean}
541405
function _isSvgFile(file, dirPath) {
	let flag = false,
		isFile = fs.statSync(path.resolve(dirPath, file)).isFile();

	if (isFile) {   // Exclude directory
		if (path.extname(file) === '.svg') {    // Only accept files which with svg suffix
			flag = true;
		}
	}
	return flag;
}
534689
def new
      @svg_file = Cmtool::SvgFile.new

      respond_to do |format|
        format.html # new.html.erb
        format.xml  { render :xml => @svg_file }
      end
    end
765880
function isFile(filePath) {
  if (!isExist(filePath)) return false;
  try {
    const stat = fs.statSync(filePath);
    return stat.isFile();
  } catch (e) {
    return false;
  }
}
682357
async function bundleProgram (dirPath, destFile) {
  await validateDirPathForCLI(dirPath);
  return collecticonsBundle({
    dirPath,
    destFile
  });
}
182212
@Override
	public boolean isDirectory(String dirPath) {
		String path = dirPath.replace('/', File.separatorChar);
		return new File(baseDir, path).isDirectory();
	}
305043
function (file) {
	var folder = path.dirname(file) + '/' + path.basename( file, '.json' );
	return fs.existsSync(folder) && isDir(folder) ? folder : false;
}
108942
async function scriptsFromDirectory(dirpath) {
  const dir = (await readdir(dirpath))
    .map(name => toFullPath(name, dirpath))
    .filter(await filters.onlyFiles)
    .filter(filters.onlyWithExtension('.js'));
  const result = {};
  for (const filepath of dir) {
    const name = path.basename(filepath, '.js');
    const script = await readFile(filepath, 'utf8');
    result[name] = script;
  }
  return result;
}
1251179
function getThemeByFile(file) {
        var path = file._path;
        return _.find(loadedThemes, function (item) {
            return item.file._path === path;
        });
    }
875774
function makeSpritePath(options, groups) {
	var base = options.spritePath;
	var file;

	// If is svg, do st
	if (groups.indexOf('GROUP_SVG_FLAG') > -1) {
		groups = _.filter(groups, function (item) {
			return item !== 'GROUP_SVG_FLAG';
		});
		file = path.resolve(base, groups.join('.') + '.svg');
	} else {
		file = path.resolve(base, groups.join('.') + '.png');
	}

	return file.replace('.@', options.retinaInfix);
}
377888
function isFileOrDir(filePath) {
	let fsStat;
	try {
		fsStat = fs.statSync(filePath);
	} catch (error) {
		return error;
	}

	let r = 'file';
	if (fsStat.isDirectory()) {
		r = 'directory';
	}

	return r;
}
392600
function (file) {

        if (fs.existsSync(file)) {
            var stat = fs.statSync(file);
            if (stat.isDirectory()) {

                var dirs = file.split(path.sep);
                var basedir = dirs[dirs.length - 1];

                return this.filterBasename(basedir) ? true : false;

            } else {

                return this.filterBasename(path.basename(file))
                && this.filterExtname(path.extname(file));
            }

        } else {
            return false;
        }
    }
851414
function(dirpath, file) {
    var templateFile = Path.join(__dirname, '../template/app', dirpath, file),
        outputFile = Path.join(appPath, dirpath, file);
    try {
      var template = new Template({text: FS.readFileSync(templateFile).toString(), watchFile:false});
      FS.writeFileSync(outputFile, template.apply(templateParams));
    } catch(e) {
      logger.fatal('Template', 'Cannot process template file: ' + templateFile + '. reason: ', e.toString());
      process.exit(1);
    }
  }
676011
def svg(file, svg_args, box, paint, trans)
      Squib.logger.debug {"Rendering: #{file}, id: #{id} @#{x},#{y} #{width}x#{height}, alpha: #{alpha}, blend: #{blend}, angle: #{angle}, mask: #{mask}"}
      Squib.logger.warn 'Both an SVG file and SVG data were specified' unless file.to_s.empty? || svg_args.data.to_s.empty?
      return if (file.nil? or file.eql? '') and svg_args.data.nil? # nothing specified TODO Move this out to arg validator
      svg_args.data = File.read(file) if svg_args.data.to_s.empty?
      begin
        svg = Rsvg::Handle.new_from_data(svg_args.data)
      rescue Rsvg::Error::Failed
        Squib.logger.error "Invalid SVG data. Is '#{file}' a valid svg file?"
        return
      end
      box.width    = svg.width  if box.width == :native
      box.height   = svg.height if box.height == :native
      box.width  = svg.width.to_f * box.height.to_f / svg.height.to_f if box.width == :scale
      box.height = svg.height.to_f * box.width.to_f / svg.width.to_f  if box.height == :scale
      scale_width  = box.width.to_f / svg.width.to_f
      scale_height = box.height.to_f / svg.height.to_f
      use_cairo do |cc|
        cc.translate(box.x, box.y)
        cc.flip(trans.flip_vertical, trans.flip_horizontal, box.width / 2, box.height / 2)
        cc.rotate(trans.angle)
        cc.scale(scale_width, scale_height)

        trans.crop_width  = box.width  if trans.crop_width  == :native
        trans.crop_height = box.height if trans.crop_height == :native
        cc.rounded_rectangle(0, 0, trans.crop_width / scale_width, trans.crop_height / scale_height, trans.crop_corner_x_radius, trans.crop_corner_y_radius)
        cc.clip
        cc.translate(-trans.crop_x, -trans.crop_y)

        cc.operator = paint.blend unless paint.blend == :none
        if paint.mask.to_s.empty?
          cc.render_rsvg_handle(svg, id: svg_args.id)
        else
          tmp = Cairo::ImageSurface.new(box.width / scale_width, box.height / scale_height)
          tmp_cc = Cairo::Context.new(tmp)
          tmp_cc.render_rsvg_handle(svg, id: svg_args.id)
          cc.set_source_squibcolor(paint.mask)
          cc.mask(tmp, 0, 0)
        end
      end
    end
1319573
function isRelativeFilepath(str) {
  if (str) {
    return (
      isFilepath(str) && (str.indexOf('./') == 0 || str.indexOf('../') == 0)
    );
  }
  return false;
}
375555
function isDirectory(filePath) {
  if (!isExist(filePath)) return false;
  try {
    const stat = fs.statSync(filePath);
    return stat.isDirectory();
  } catch (e) {
    return false;
  }
}
1016191
def is_svg(code):
    

    if rsvg is None:
        return

    try:
        rsvg.Handle(data=code)

    except glib.GError:
        return False

    # The SVG file has to refer to its xmlns
    # Hopefully, it does so wiyhin the first 1000 characters

    if "http://www.w3.org/2000/svg" in code[:1000]:
        return True

    return False
1038674
def svg2rlg(path, **kwargs):
    ""

    # unzip .svgz file into .svg
    unzipped = False
    if isinstance(path, str) and os.path.splitext(path)[1].lower() == ".svgz":
        with gzip.open(path, 'rb') as f_in, open(path[:-1], 'wb') as f_out:
            shutil.copyfileobj(f_in, f_out)
        path = path[:-1]
        unzipped = True

    svg_root = load_svg_file(path)
    if svg_root is None:
        return

    # convert to a RLG drawing
    svgRenderer = SvgRenderer(path, **kwargs)
    drawing = svgRenderer.render(svg_root)

    # remove unzipped .svgz file (.svg)
    if unzipped:
        os.remove(path)

    return drawing