docs: public boolean initOutPathLocalFS(Path outPath, WriteMode writeMode, boolean createDirectory) throws IOException {
  		if (isDistributedFS()) {
  			return false;
  		}
  
  		// NOTE: We actually need to lock here (process wide). Otherwise, multiple threads that
  		// concurrently work in this method (multiple output formats writing locally) might end
  		// up deleting each other's directories and leave non-retrievable files, without necessarily
  		// causing an exception. That results in very subtle issues, like output files looking as if
  		// they are not getting created.
  
  		// we acquire the lock interruptibly here, to make sure that concurrent threads waiting
  		// here can cancel faster
  		try {
  			OUTPUT_DIRECTORY_INIT_LOCK.lockInterruptibly();
  		}
  		catch (InterruptedException e) {
  			// restore the interruption state
  			Thread.currentThread().interrupt();
  
  			// leave the method - we don't have the lock anyways
  			throw new IOException("The thread was interrupted while trying to initialize the output directory");
  		}
  
  		try {
  			FileStatus status;
  			try {
  				status = getFileStatus(outPath);
  			}
  			catch (FileNotFoundException e) {
  				// okay, the file is not there
  				status = null;
  			}
  
  			// check if path exists
  			if (status != null) {
  				// path exists, check write mode
  				switch (writeMode) {
  
  				case NO_OVERWRITE:
  					if (status.isDir() && createDirectory) {
  						return true;
  					} else {
  						// file may not be overwritten
  						throw new IOException("File or directory " + outPath + " already exists. Existing files and directories " +
  								"are not overwritten in " + WriteMode.NO_OVERWRITE.name() + " mode. Use " +
  								WriteMode.OVERWRITE.name() + " mode to overwrite existing files and directories.");
  					}
  
  				case OVERWRITE:
  					if (status.isDir()) {
  						if (createDirectory) {
  							// directory exists and does not need to be created
  							return true;
  						} else {
  							// we will write in a single file, delete directory
  							try {
  								delete(outPath, true);
  							}
  							catch (IOException e) {
  								throw new IOException("Could not remove existing directory '" + outPath +
  										"' to allow overwrite by result file", e);
  							}
  						}
  					}
  					else {
  						// delete file
  						try {
  							delete(outPath, false);
  						}
  						catch (IOException e) {
  							throw new IOException("Could not remove existing file '" + outPath +
  									"' to allow overwrite by result file/directory", e);
  						}
  					}
  					break;
  
  				default:
  					throw new IllegalArgumentException("Invalid write mode: " + writeMode);
  				}
  			}
  
  			if (createDirectory) {
  				// Output directory needs to be created
  				if (!exists(outPath)) {
  					mkdirs(outPath);
  				}
  
  				// double check that the output directory exists
  				try {
  					return getFileStatus(outPath).isDir();
  				}
  				catch (FileNotFoundException e) {
  					return false;
  				}
  			}
  			else {
  				// check that the output path does not exist and an output file
  				// can be created by the output format.
  				return !exists(outPath);
  			}
  		}
  		finally {
  			OUTPUT_DIRECTORY_INIT_LOCK.unlock();
  		}
  	}