Creates the conf directory and file.
Writes the properties to the generated file.

@param dir the conf directory to create
@param properties the specific properties of the current node
979603
private void writeConfToFile(File dir, Map<PropertyKey, String> properties) throws IOException {
    // Generates the full set of properties to write
    Map<PropertyKey, String> map = new HashMap<>(mProperties);
    for (Map.Entry<PropertyKey, String> entry : properties.entrySet()) {
      map.put(entry.getKey(), entry.getValue());
    }

    StringBuilder sb = new StringBuilder();
    for (Entry<PropertyKey, String> entry : map.entrySet()) {
      sb.append(String.format("%s=%s%n", entry.getKey(), entry.getValue()));
    }

    dir.mkdirs();
    try (FileOutputStream fos
        = new FileOutputStream(new File(dir, "alluxio-site.properties"))) {
      fos.write(sb.toString().getBytes(Charsets.UTF_8));
    }
  }
173973
def __set_dir_properties(self):
        
        directories = [
            ("home", "The ROUGE home directory."),
            ("data", "The path of the ROUGE 'data' directory."),
            ("system", "Path of the directory containing system summaries."),
            ("model", "Path of the directory containing model summaries."),
            ]
        for (dirname, docstring) in directories:
            self.__create_dir_property(dirname, docstring)
777903
private static void rmDir(File dir) {
        for (File file: dir.listFiles()) {
            if (file.isDirectory()) {
                rmDir(file);
            } else {
                if (!file.delete()) {
                    logger.warn("Can't delete file " + file);
                }
            }
        }
        if (!dir.delete()) {
            logger.warn("Can't delete dir " + dir);
        }
    }
1072869
private void writeProperties() throws IOException
   {
      writeAttributeTypes("property_types", ProjectField.values());
      writeFields("property_values", m_projectFile.getProjectProperties(), ProjectField.values());
   }
1019518
def __create_dir_property(self, dir_name, docstring):
        
        property_name = "{}_dir".format(dir_name)
        private_name = "_" + property_name
        setattr(self, private_name, None)

        def fget(self):
            return getattr(self, private_name)

        def fset(self, path):
            verify_dir(path, dir_name)
            setattr(self, private_name, path)

        p = property(fget=fget, fset=fset, doc=docstring)
        setattr(self.__class__, property_name, p)
333448
function(dir) {
  var methods = [];

  var findConfigFiles = function(dir) {
    fs.readdirSync(dir).forEach(function(file) {
      file = path.join(dir, file);
      var stat = fs.statSync(file);
      if(stat && stat.isDirectory()) {
        findConfigFiles(file);
      } else if(/config.js$/.test(file)) {
        methods.push(file);
      }
    });
  };

  findConfigFiles(dir);

  return methods;
}
1052042
void createDirectory(Path path) throws IOException {
		if (Files.exists(path) && Files.isDirectory(path)) {
			return;
		}

		if (this.readOnly) {
			throw new FileNotFoundException(
					"The requested directory \""
							+ path.toString()
							+ "\" does not exist and we are in read-only mode, so it cannot be created.");
		}

		Files.createDirectory(path);
	}
131369
private void createSystemFolder() throws IOException {
        if(!Files.exists(systemLocation.toPath()))
            Files.createDirectories(systemLocation.toPath());
    }
387407
void writeCoreInDirectory(String dir, String fwk) {
		if (dir != null) { // if developper specify a directory for get js we write them too inside jsdir 
			fws.copyResourceToDir(ProcessorConstants.SEPARATORCHAR + "js", getFilename("core", fwk), dir);
		}
	}
731052
public boolean writeTrustRoots(String directory) throws IOException {
        if (this.trustrootFilenames == null || this.trustrootData == null) {
            return false;
        }
        File rootDir = new File(directory);
        if (!rootDir.exists()) {
            rootDir.mkdirs();
        }
        for (int i = 0; i < trustrootFilenames.length; i++) {
            FileOutputStream out = new FileOutputStream(
                directory + File.separator + this.trustrootFilenames[i]);
            out.write(this.trustrootData[i].getBytes());
            out.close();
        }
        return true;
    }
1358467
public void addNode (int x, int y, int dir)
    {
        _nodes.add(new PathNode(x, y, dir));
    }
610492
private void createPropertiesFolder() throws IOException {
        if(!Files.exists(propertiesLocation.toPath()))
            Files.createDirectories(propertiesLocation.toPath());
    }
868679
public static boolean writeProperties(File _file, Properties _props) {
        LOGGER.debug("Trying to write Properties to file: " + _file);
        try (FileOutputStream out = new FileOutputStream(_file)) {
            _props.store(out, _file.getName());
            LOGGER.debug("Successfully wrote properties to file: " + _file);
        } catch (IOException _ex) {
            LOGGER.warn("Could not save File: " + _file, _ex);
            return false;
        }
        return true;
    }
1156861
public static void createDirectory(final String directory) {
        if (directory == null) return;
        final File f = new File(directory);
        if (!f.isDirectory()) {
            if (!f.mkdir()) throw new RuntimeException("couldn't create "
                    + directory);
        }
    }
1100987
function createTree (context, folder) {
  const tree = []
  const files = []

  let directoryContents = []

  try {
    directoryContents = fs.readdirSync(path.join(context, folder))
  } catch (error) {
    // Throw error if it’s not a permissions error
    if (error.code !== 'EACCESS') {
      throw error
    }
  }

  // Folders first
  directoryContents
    .filter(item => {
      return fs
        .lstatSync(path.join(context, folder, item))
        .isDirectory()
    })
    .forEach(item => {
      const children = createTree(context, path.join(folder, item))

      // Don’t add current directory to tree if it has no children
      if (children.tree.length) {
        tree.push({
          name: formatName(item),
          children: children.tree
        })
      }

      files.push(...children.files)
    })

  // Files second
  directoryContents
    .filter(item => item.endsWith('.njk'))
    .forEach(item => {
      const basename = path.basename(item, '.njk')
      const filePath = formatPath(folder, item)
      const configPath = path.join(context, folder, basename + '.json')

      let config

      try {
        config = JSON.parse(fs.readFileSync(configPath))
      } catch (error) {
        config = {}
      }

      // Don’t add current component to tree if it’s hidden
      if (config.hidden) {
        return
      }

      tree.push({
        name: formatName(basename),
        path: filePath.slice(0, -4),
        config
      })

      files.push(filePath)
    })

  return { files, tree }
}
381509
public void setDataHomeFile(File dir) {
        if (dir != null) {
            try {
                // Switch to canonical for more detailed error messages.
                dir = dir.getCanonicalFile();
            } catch (IOException e) {
            }
        }
        mDataHome = dir;
    }
95447
public static void writePropertiesFile( Properties properties, File file ) throws IOException {

		OutputStream out = null;
		try {
			out = new FileOutputStream( file );
			properties.store( out, "" );

		} finally {
			closeQuietly( out );
		}
	}