Creates a file for a given absolute file name (absolute path and file name).
@param fn absolute file name
@return null on success, error string otherwise
340695
public static String createFile(String fn){
		File file = new File(fn);
		try {
			file.createNewFile();
		}
		catch (IOException e) {
			return e.getMessage();
		}
		return null;
	}
389322
protected static File unix2os(String filename) {
		File file = null;
		for (final String base : filename.split(Pattern.quote("/"))) { //$NON-NLS-1$
			if (file == null) {
				file = new File(base);
			} else {
				file = new File(file, base);
			}
		}
		return file;
	}
1316498
public function createNewFile($mode = null)
    {
        if ($this->isAbsolute()) {
            if (is_null($mode)) {
                $mode = $this->defaul_permission;
            }

            if ($resource = fopen($this->getPathname(), 'x')) {
                fclose($resource);
                $this->chmod($mode);
                return true;
            }
            return false;
        } else {
            throw new FileException('Given file path is not a absolute path.');
        }
    }
43282
public static File getFileFromDirectoryInClassPath(String fileName, String classPath) {

		Collection<String> paths = StringSupport.split(classPath, ";:", false);

		for(String singlePath : paths) {
			File dir = new File(singlePath);
			if (dir.isDirectory()) {
				File file = new File(singlePath + '/' + fileName);
				if (file.exists()) {
					return file;
				}
			}
		}
		return null;
	}
1162993
function (fileName) {
            if (!file.exists(fileName)) {
                try {
                    //Try to find the path of the file thanks to node's require resolving.
                    fileName = nodeRequire.resolve(fileName);
                } catch(e) {}
            }
            return frontSlash(path.normalize(frontSlash(fs.realpathSync(fileName))));
        }
200216
public static File toFile(final String filename) {
        if (filename == null) {
            return null;
        }
        String f;
        try {
            f = URLDecoder.decode(filename, UTF8);
        } catch (final UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        f = f.replace(WINDOWS_SEPARATOR, File.separator).replace(UNIX_SEPARATOR, File.separator);
        return new File(f);
    }
1134951
public WritableByteChannel create(URI path, CreateFileOptions options) throws IOException {
    logger.atFine().log("create(%s)", path);
    Preconditions.checkNotNull(path, "path could not be null");
    if (FileInfo.isDirectoryPath(path)) {
      throw new IOException(
          String.format("Cannot create a file whose name looks like a directory. Got '%s'", path));
    }

    // Check if a directory of that name exists.
    if (options.checkNoDirectoryConflict()) {
      URI dirPath = FileInfo.convertToDirectoryPath(pathCodec, path);
      if (exists(dirPath)) {
        throw new FileAlreadyExistsException("A directory with that name exists: " + path);
      }
    }

    // Ensure that parent directories exist.
    if (options.ensureParentDirectoriesExist()) {
      URI parentPath = getParentPath(path);
      if (parentPath != null) {
        mkdirs(parentPath);
      }
    }

    return createInternal(path, options);
  }
776892
protected String createFile(String dir, String fileName, byte[] content) {
        String baseName = FilenameUtils.getBaseName(fileName);
        String ext = FilenameUtils.getExtension(fileName);
        String downloadedFile = FileUtil.saveToFile(dir + baseName, ext, content);
        return linkToFile(downloadedFile);
    }
451610
static PathFileObject createSiblingPathFileObject(JavacPathFileManager fileManager,
            final Path path, final String relativePath) {
        return new PathFileObject(fileManager, path) {
            @Override
            String inferBinaryName(Iterable<? extends Path> paths) {
                return toBinaryName(relativePath, "/");
            }
        };
    }
685459
public static File getOrCreateFile(String url, boolean createIfNotFound) throws IOException {
        File file = null;
        if (url.contains(ResourceUtils.CLASSPATH_URL_PREFIX)) {
            url = url.replaceAll(ResourceUtils.CLASSPATH_URL_PREFIX, "");
            if (url.startsWith("/")) {
                url = url.substring(1);
            }
            URL resource = SenBotContext.class.getClassLoader().getResource("");
            if (resource == null) {
                throw new IOException("creating a new folder on the classpath is not allowed");
            } else {
                file = new File(resource.getFile() + "/" + url);
            }
        } else {
            file = new File(url);
        }
        if (createIfNotFound && !file.exists()) {
            file.mkdirs();
        }
        return file;
    }
839674
public static File locateFile(String fname) {
    // When run from eclipse, the working directory is different.
    // Try pointing at another likely place
    File file = new File(fname);
    if( !file.exists() )
      file = new File("target/" + fname);
    if( !file.exists() )
      file = new File("../" + fname);
    if( !file.exists() )
      file = new File("../../" + fname);
    if( !file.exists() )
      file = new File("../../../" + fname);
    if( !file.exists() )
      file = new File("../target/" + fname);
    if( !file.exists() )
      file = new File(StringUtils.expandPath(fname));
    if( !file.exists() )
      file = null;
    return file;
  }
991836
public static File openOrCreate(String path,String fileName) throws IOException {
        Path filePath = Paths.get(path, fileName);
        File file = filePath.toFile();
        if (file.exists()) {
            if (file.isFile()) {
                return file;
            }
            throw new FileNotFoundException(path+" is discroty");
        }else {
            mkirDirs(filePath.getParent());
            file.createNewFile();
            return file;
        }
    }
546591
static PathFileObject createJarPathFileObject(JavacPathFileManager fileManager,
            final Path path) {
        return new PathFileObject(fileManager, path) {
            @Override
            String inferBinaryName(Iterable<? extends Path> paths) {
                return toBinaryName(path);
            }
        };
    }
133835
public static FileWriter createFile(String name, String outDir) throws IOException
   {
      File path = new File(outDir);
      if (!path.exists())
      {
         if (!path.mkdirs())
            throw new IOException("outdir can't be created");
      }

      File file = new File(path.getAbsolutePath() + File.separatorChar + name);

      if (file.exists())
      {
         if (!file.delete())
            throw new IOException("there is exist file, please check");
      }

      return new FileWriter(file);
   }
991452
function (filename, fn) {

		fn = fn || function () {};

		this._image.pack().pipe(fs.createWriteStream(filename)).once('close', function () {
			this._image.removeListener('error', fn);
			fn(undefined, this);
		}.bind(this)).once('error', function (err) {
			this._image.removeListener('close', fn);
			fn(err, this);
		}.bind(this));
	}
1312905
public boolean add(String fileName) {
      writeLock.lock();
      try {
         return filenames.add(fileName);
      } finally {
         writeLock.unlock();
      }
   }
492468
public void addFile(String filename) {
        synchronized (files) {
            if (!files.contains(filename)) {
                files.add(filename);
            }
        }
    }