Ensure that the path pointed to by 'path' is a directory, if possible
@param path
@param name
@return File that is a created directory
@throws IOException
163913
public static File ensureDir(String path, String name) throws IOException {
		if((path == null) || (path.length() == 0)) {
			throw new IOException("No configuration for (" + name + ")");
		}
		File dir = new File(path);
		if(dir.exists()) {
			if(!dir.isDirectory()) {
				throw new IOException("Dir(" + name + ") at (" + path + 
						") exists but is not a directory!");
			}
		} else {
			if(!dir.mkdirs()) {
				throw new IOException("Unable to create dir(" + name +") at ("
						+ path + ")");
			}
		}
		return dir;
	}
804197
public boolean isFile(Path f) throws IOException {
    try {
      return !getFileStatus(f).isDir();
    } catch (FileNotFoundException e) {
      return false;               // f does not exist
    }
  }
793338
static FileWriter createOrGetFile(File folder, String name) throws IOException {
		File file = new File(folder, name + ".json");
		if (!file.exists()) {
			Files.createFile(file.toPath());
		}
		FileWriter fr = new FileWriter(file);
		return fr;
	}
894959
public static void copyFile(@NotNull Path from, @NotNull Path to) throws IOException {
		Validate.isTrue(Files.exists(from), "%s is not exist or not a file", from);
		Validate.notNull(to);
		Validate.isTrue(!FileUtil.isDirExists(to), "%s is exist but it is a dir", to);
		Files.copy(from, to);
	}
1105399
private File getFileFromPath(final String path) {
        File result = (path != null) ? new File(path) : null;
        // AS7-1752 see if a non-existent relative path exists relative to the home dir
        if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) {
            File relative = new File(homeDir, path);
            if (relative.exists()) {
                result = relative;
            }
        }
        return result;
    }
1106018
public static String joinZKPath(String path, String name) {
        if (path.endsWith("/")) {
            return path + name;
        } else {
            return path + "/" + name;
        }
    }
735332
protected function _mkfile($path, $name) {
		$path = $path.DIRECTORY_SEPARATOR.$name;
		
		if (($fp = @fopen($path, 'w'))) {
			@fclose($fp);
			@chmod($path, $this->options['fileMode']);
			return $path;
		}
		return false;
	}
1021602
public static String path( String path ) {
		String pathToBase = getPathToBase();
		if( pathToBase == null )
			return path;
		return new File(pathToBase,path).getAbsolutePath();
	}
839213
private String getRealPath( String path )
            throws IOException
    {

        URL fileURL = _servletContext.getResource( path );

        File tempDir = (File) _servletContext.getAttribute( "javax.servlet.context.tempdir" );

        // download file into temp dir
        if ( fileURL != null )
        {
            File newFile = File.createTempFile( "temp", ".jar", tempDir );
            if ( download( fileURL, newFile ) )
            {
                String filePath = newFile.getPath();
                return filePath;
            }
        }
        return null;
    }
52199
public boolean isDirectory(String path) {

		boolean isDirectory = false;
		String realPath = getRealResourcePath(path);
		if (isFileSystemPath(path, realPath)) { // The resource has been
												// remapped to a file system
												// path
			isDirectory = new File(realPath).isDirectory();
		} else {
			isDirectory = super.isDirectory(realPath);
		}
		return isDirectory;
	}
74734
public static File createTempDirectory(String _path, String _name, boolean _deleteOnExit) {

        File outputDir = new File(concatFilePath(_path, _name));
        if (!outputDir.exists()) {
            try {
                Files.createDirectory(Paths.get(outputDir.toString()));
            } catch (IOException _ex) {
                LOGGER.error("Error while creating temp directory: ", _ex);
            }
        } else {
            return null;
        }
        if (_deleteOnExit) {
            outputDir.deleteOnExit();
        }
        return outputDir;
    }
1371963
public static File createFile(String filename) throws IOException {
		File file = new File(filename);
		if (!file.exists()) {
			if(file.getParent() != null) {
				File path = new File(file.getParent());
				path.mkdirs();
			}
			file.createNewFile();
		}
		return file;
	}
948630
def _make_path(self, path, name):
        
        if not os.path.exists(path):
            os.mkdirs(path)

        if os.path.isdir(path) :
            return os.path.join(path, name)

        return path
1012184
public static File mkdir(String dirPath) {
		if (dirPath == null) {
			return null;
		}
		final File dir = file(dirPath);
		return mkdir(dir);
	}
767027
public static String createFolderPath(String path) {

        String[] pathParts = path.split("\\.");
        String path2 = "";
        for (String part : pathParts) {
            if (path2.equals("")) {
                path2 = part;
            } else {
                path2 = path2 + File.separator
                        + changeFirstLetterToLowerCase(createClassName(part));
            }
        }

        return path2;
    }
785400
def isdir(path):
    
    system = get_instance(path)

    # User may use directory path without trailing '/'
    # like on standard file systems
    return system.isdir(system.ensure_dir_path(path))
485819
public static void createFile(String filePath) throws IOException {
    Path storagePath = Paths.get(filePath);
    Files.createDirectories(storagePath.getParent());
    Files.createFile(storagePath);
  }