Resolves file path, and ensures the file exist.

@param {string} file - File path.
@returns {string|boolean} Resolved file path, or false if path cannot be
created.
767019
function(file) {
    var filePath = path.resolve(file);

    if (filePath) {
      if (!fs.existsSync(filePath)) {
        fse.ensureFileSync(filePath);
      }
      return filePath;
    }

    return false;
  }
735610
function(file) {
        var self = this;

        var ext;

        if (!self._options.keepExtension) {
            ext = self._options.extension || path.extname(file);
        }

        var fileName = path.basename(file, ext);

        if (self._options.format) {
            var formatRegex = self._options.format[0].split('/');
            formatRegex = new RegExp(formatRegex[1], formatRegex[2]);

            var replaceValue = self._options.format[1];

            fileName = fileName.replace(formatRegex, replaceValue);
        }

        var moduleConfig = {
            name: '',
            version: '1.0.0'
        };

        if (self._options.moduleConfig) {
            if (typeof self._options.moduleConfig === 'string') {
                var fileModuleConfig = path.resolve(self._options.moduleConfig);

                if (fs.existsSync(fileModuleConfig)) {
                    moduleConfig = require(fileModuleConfig);
                }
            } else {
                moduleConfig = self._options.moduleConfig;
            }
        }

        fileName = path.join(path.dirname(file), fileName);

        var moduleName = '';

        if (moduleConfig.name) {
            moduleName = moduleConfig.name + '@' + moduleConfig.version;
        }

        moduleName = path.join(moduleName, fileName.substring(self._options.moduleRoot.length));

        if (self._options.lowerCase) {
            moduleName = moduleName.toLowerCase();
        }

        return upath.toUnix(moduleName);
    }
237321
function setAbsolutePath(file) {
    file.absolutePath = path.resolve(process.cwd(), file.fullPath);
    return file.absolutePath;
  }
43455
function(filename){
    // resolve by symlink if possible
    for (var from in this.symlinks)
      if (filename.indexOf(from) === 0 && (filename === from || filename[from.length] === '/'))
        return this.symlinks[from] + filename.substr(from.length);

    return path.resolve(this.fsBaseURI, filename.replace(/^[\\\/]/, ''));
  }
376172
function(file, opt)
{
  //Check the file
  if(typeof file !== 'string'){ throw new Error('Missing file argument'); return null; }

  //Check the options
  if(typeof opt === 'undefined'){ var opt = {}; }

  //Save the file name
  this._file = file;

  //Check the encoding option
  this._encoding = (typeof opt.encoding === 'undefined') ? 'utf8' : opt.encoding.toString();

  //Check the chunk option
  this._chunk = (typeof opt.chunk === 'undefined') ? 10240 : opt.chunk;

  //Check the line break option
  this._endl = (typeof opt.endl === 'undefined') ? 0x0a : opt.endl;

  //Check the emptylines option
  this._emptyLines = (typeof opt.emptyLines === 'undefined') ? true : opt.emptyLines;

  //File object
  this._fd = null;

  //Actual position
  this._position = (typeof opt.start === 'undefined') ? 0 : opt.start;

  //Line count
  this._count = 0;

  //Events
  this._events = {};

  //Return this
  return this;
}
1180552
function resolveComponent (file) {
  // make sure relative paths resolved to somewhere inside veui
  let pkg = pkgDir.sync(file)
  if (!pkg || getJSON(path.join(pkg, 'package.json')).name !== 'veui') {
    return null
  }

  // veui/${dir} or veui/src/${dir}
  let dirPath = path.join(pkg, COMPONENTS_DIRNAME) // runtime
  if (!fs.existsSync(dirPath)) {
    dirPath = path.join(pkg, 'src', COMPONENTS_DIRNAME) // dev
    if (!fs.existsSync(dirPath)) {
      return null
    }
  }

  // is VEUI component
  return getComponentName(path.relative(dirPath, file))
}
629451
function resolve() {
            resolvePath(path, function (err, _resolvedPath) {
                if (err) {
                    if (err.code !== "ENOENT") {
                        return error(err);
                    }
                    // If checkSymlinks is on we'll get an ENOENT when creating a new file.
                    // In that case, just resolve the parent path and go from there.
                    resolvePath(dirname(path), function (err, dir) {
                        if (err) return error(err);
                        resolvedPath = join(dir, basename(path));
                        createTempFile();
                    });
                    return;
                }
                
                resolvedPath = _resolvedPath;
                createTempFile();
            });
        }
1319305
function(file, opts) {
	if (util.isObject(file) || util.isArray(file)) {
		return file;
	}

	var options = util.extend({
		asText: false, // true, false, 'pretty'
		javascript: false, // true, false
		scope: '', // directory to look for initial file
		variables: {
			// contains a key->value object with variables to @extends
		}
	}, opts);

	file = util.template(file, options.variables);

	/*****************************************************************************
	*  Initialize
	*****************************************************************************/

	var file_path;

	// If the file path is absolute use it
	// If not then prepend the current scope of the previous file.
	if (path.resolve(file) === path.normalize(file)) {
		file_path = path.normalize(file);
	}
	else {
		file_path = path.normalize(
			options.scope ? options.scope + '/' + file : file
		);
	}
	var class_json = parseFile(file_path, options);

	// Stores JSON objects of files that have to be merged together:
	// ["a", "b"]
	var file_list = util.isArray(class_json[indicators.EXTENDS]) ?
		class_json[indicators.EXTENDS] :
		class_json[indicators.EXTENDS] != null ?
			[ class_json[indicators.EXTENDS] ] :
			[];

	// Delete @extends from base_json to avoid infinitive recursion
	delete class_json[indicators.EXTENDS];

	// Push class_json to the path list:
	file_list.push(class_json);
	/*****************************************************************************
	*  Merge file by file
	*****************************************************************************/

	// default config for each file required:
	// set asText = false so we get an object returned
	// set scope = file's directory so there can be relative references
	var json_config = util.defaults({
		asText: false,
		scope: path.dirname(file_path),

		// _as is a hack so that we know its we are calling the function recursive
		_as: ANTI_SANITIZER
	}, options);

	// super_json is our output, start by containing first file in array
	var super_json = fromFile(file_list.shift(), json_config);

	// TODO: Figure out when to sanitize super_json hopefully we don't have to
	//   santize all returns. I'm not sure about this, and I'm not sure if we
	//   can even sanitize super_json when we return it.
	//   Is super_json used by anyone recursively?

	while (file_list.length) {
		var json = fromFile(file_list.shift(), json_config);

		merge(super_json, json);
	}

	// If this file is called from the outside eg json_merger.from...
	//   File('file_which_doesnt_extends_another_file.json')
	//   we need to sanitize the file and remove all indicators
	if (options._as != ANTI_SANITIZER) {
		super_json = util.sanitizeValue(super_json);
	}

	/*****************************************************************************
	*  Return super_json
	*****************************************************************************/
	if (options.asText) {
		return stringify(super_json, options);
	}
	else {
		return super_json;
	}
}
785532
function globPromise (file) {
    return new Promise((resolve, reject) => {
      glob(file, (err, files) => {
        if (err) {
          reject(err)
        } else {
          resolve(files)
        }
      })
    })
  }
341514
function doesFileExist (path) {
  return new Promise(resolve => {
    fs.stat(path, (err, stat) => {
      // The file exists if there were no errors, and it's a file
      resolve(!err && stat.isFile())
    })
  })
}
889237
function initFile (file) {
  if (!file.oss) {
    file.oss = {};
    file.oss.headers = {};
    file.oss.path = file.relative.replace(/\\/g, '/');
  }
  return file;
}
422862
function(fileName, content) {
                return Promise()
                .then(function() {
                    var filePath = PathUtils.resolveInRoot(outputFolder, fileName);

                    return fs.exists(filePath);
                });
            }
137982
function resolveFile(file, pathes) {
    var strResult = '';

    for(var i = 0, len = pathes.length; i < len; i ++) {
        extName = path.extname(pathes[i]);
        switch (extName) {
            case '.js':
                strResult += resolveScripts(file, [pathes[i]]);
                break;
            case '.css':
                strResult += resolveStylesheet(file, [pathes[i]]);
                break;
            case '.html':
                strResult += resolveTemplate(file, [pathes[i]]);
                break;
            default :
                throw new PluginError("gulp-xinclude", "暂不支持类型[" + extName + "]的文件");
        }
    }
    return strResult;
}
1215973
function fileExists(fileName) {
        if (!fileName) {
            return false;
        }

        var filePath = PathUtils.resolveInRoot(outputFolder, fileName);
        return fs.existsSync(filePath);
    }
1032967
function (file) {
        var extname = path.extname(file);
        var id = file.replace(this.base + '/', '').replace(extname, '');
        return id;
    }
1336859
function check(filename) {
  this.filename = filename && path.resolve(filename) || '';
  this.types = [];
  this.valid = null;
}
1365449
function isValidFile(file) {
    var fs = require("fs");
    try {
        return fs.statSync(file).isFile();
    } catch (err) {
        return false;
    }
}