Set the output directory for extracted files.

        @path - The path to the file that data will be extracted from.

        Returns None.
480839
def build_output_directory(self, path):
        '''
        
        '''
        # If we have not already created an output directory for this target
        # file, create one now
        if not has_key(self.extraction_directories, path):
            basedir = os.path.dirname(path)
            basename = os.path.basename(path)

            if basedir != self.directory:
                # During recursive extraction, extracted files will be in subdirectories
                # of the CWD. This allows us to figure out the subdirectory by simply
                # splitting the target file's base directory on our known CWD.
                #
                # However, the very *first* file being scanned is not necessarily in the
                # CWD, so this will raise an IndexError. This is easy to handle though,
                # since the very first file being scanned needs to have its contents
                # extracted to ${CWD}/_basename.extracted, so we just set the subdir
                # variable to a blank string when an IndexError is encountered.
                try:
                    subdir = basedir.split(self.directory)[1][1:]
                except IndexError as e:
                    subdir = ""
            else:
                subdir = ""

            if self.output_directory_override:
                output_directory = os.path.join(self.directory, subdir, self.output_directory_override)
            else:
                outdir = os.path.join(self.directory, subdir, '_' + basename)
                output_directory = unique_file_name(outdir, extension='extracted')

            if not os.path.exists(output_directory):
                os.mkdir(output_directory)

            self.extraction_directories[path] = output_directory
            self.output[path].directory = os.path.realpath(output_directory) + os.path.sep
        # Else, just use the already created directory
        else:
            output_directory = self.extraction_directories[path]

        return output_directory
1135459
public function setOutputPath($path)
    {
        if (!file_exists($path)) {
            if (!mkdir($path, 0755, true)) {
                throw new BadOutputPathException(
                    sprintf(
                        'Output path %s does not exist and could not be created!',
                        $path
                    ),
                    $path
                );
            }
        } else {
            if (!is_dir($path)) {
                throw new BadOutputPathException(
                    sprintf(
                        'The argument to `output` is expected to the a directory, but got %s!',
                        $path
                    ),
                    $path
                );
            }
        }
        $this->path = $path;
    }
1283778
function (output) {
              // Manually convert paths to relative, because LESS
              // can make tose absolute for complex cases.
              var map = JSON.parse(output);
              var dir = path.dirname(context.pathname);
              map.sources.forEach(function (file, idx) {
                var rel = path.relative(dir, file);
                if (path.sep === '\\') { rel = rel.replace('\\', '/'); }
                map.sources[idx] = rel;
              });

              self.map = JSON.stringify(map);
            }
1274639
def _generate_output_dir(settings, path):
        

        relpath = os.path.relpath(settings.root,path)
        count = relpath.count(os.sep) + 1

        return relpath+os.path.sep, count
478680
public function setOutputPath($path) {
		$dir = pathinfo($path, PATHINFO_DIRNAME);
		$dir = $this->normalizePath($dir);
		
		if (! is_dir($dir)) {
			throw new InvalidPath('Invalid directory: "' . $dir . '"');
		}
		
		if (! is_writable($dir)) {
			throw new InvalidPath('The directory: "' . $dir . '" is unwritable');
		}
		
		if (is_file($path) && ! is_writable($path)) {
			throw new InvalidPath('The File "' . $path . '" exists. but unwritable');
		}
		
		$this->outputFile = $dir . DIRECTORY_SEPARATOR . pathinfo($path, PATHINFO_BASENAME);
		
		return $this;
	}
956508
def chdir(path: str) -> Iterator[None]:
    
    curdir = os.getcwd()
    os.chdir(path)
    try:
        yield
    finally:
        os.chdir(curdir)
105038
def _set_WorkingDir(self, path):
        
        self._curr_working_dir = path
        try:
            mkdir(self.WorkingDir)
        except OSError:
            # Directory already exists
            pass
547937
public Path getOutputDirectory()
    {
        File file = getOptionValue(OutputPathOption.NAME);
        return file == null ? null : file.toPath();
    }
742173
def write_out(path = nil)
      return img unless path
      FileUtils.mkdir_p File.dirname(path)
      img.write(path)
      path
    rescue Errno::ENOENT
      puts_and_exit("Path not found '#{path}'")
    end
566705
public void extractAll(Path targetDir, CopyOption... options) throws IOException
    {
        if (!Files.isDirectory(targetDir))
        {
            throw new NotDirectoryException(targetDir.toString());
        }
        ensureReading();
        do
        {
            Path p = targetDir.resolve(filename);
            InputStream is = Channels.newInputStream(this);
            Files.copy(is, p, options);
            Files.setLastModifiedTime(p, lastModified);
        } while (nextInput());
    }
325688
def _get_result_paths(self,data):
        
        output_dir = self.Parameters['--out-dir'].Value
        result = {}
        result['json'] = ResultPath(Path=join(output_dir,
                                splitext(split(self._input_filename)[-1])[0] + \
                                '.jplace'))
        return result
222262
public function setOutputPath($path)
    {
        $outpath = $path;
        if (!file_exists($outpath)) {
            if (!mkdir($outpath, 0755, true)) {
                throw new BadOutputPathException(
          sprintf(
            'Output path %s does not exist and could not be created!',
            $outpath
          ),
          $outpath
        );
            }
        } else {
            if (!is_dir(realpath($outpath))) {
                throw new BadOutputPathException(
          sprintf(
            'The argument to `output` is expected to the a directory, but got %s!',
            $outpath
          ),
          $outpath
        );
            }
        }
        $this->outputPath = $outpath;
    }
1342779
def cd(self, *subpaths):
        
        target = os.path.join(*subpaths)
        os.chdir(target)
730984
def extract(path)
      files           = files_in_path(path)
      supported_files = filter_files(files)

      parse_files(supported_files)
    end
951273
def __ensure_directory_in_path(filename: Path) -> None:
    
    directory = Path(filename).parent.resolve()
    if directory not in sys.path:
        logger.debug(f"Adding {directory} to sys.path")
        sys.path.insert(0, str(directory))
606850
def set_src_filepath(self, src_dir_path):
        
        log.debug("set_src_filepath() with: '%s'", src_dir_path)
        self.abs_src_filepath = src_dir_path.resolved_path
        log.debug(" * abs_src_filepath: %s" % self.abs_src_filepath)

        if self.abs_src_filepath is None:
            log.info("Can't resolve source path: %s", src_dir_path)
            return

        self.sub_filepath = self.abs_src_filepath.relative_to(self.abs_src_root)
        log.debug(" * sub_filepath: %s" % self.sub_filepath)

        self.sub_path = self.sub_filepath.parent
        log.debug(" * sub_path: %s" % self.sub_path)

        self.filename = self.sub_filepath.name
        log.debug(" * filename: %s" % self.filename)

        self.abs_dst_path = Path2(self.abs_dst_root, self.sub_path)
        log.debug(" * abs_dst_path: %s" % self.abs_dst_path)

        self.abs_dst_filepath = Path2(self.abs_dst_root, self.sub_filepath)
        log.debug(" * abs_dst_filepath: %s" % self.abs_dst_filepath)

        self.abs_dst_hash_filepath = Path2("%s%s%s" % (self.abs_dst_filepath, os.extsep, phlb_config.hash_name))
        log.debug(" * abs_dst_hash_filepath: %s" % self.abs_dst_hash_filepath)
1277177
def extract(path_to_hex, output_path=None):
    
    with open(path_to_hex, 'r') as hex_file:
        python_script = extract_script(hex_file.read())
        if output_path:
            with open(output_path, 'w') as output_file:
                output_file.write(python_script)
        else:
            print(python_script)