MCPcopy Index your code
hub / github.com/Breakthrough/PySceneDetect / get_and_create_path

Function get_and_create_path

scenedetect/platform.py:141–167  ·  view source on GitHub ↗

Get & Create Path: Gets and returns the full/absolute path to file_path in the specified output_directory if set, creating any required directories along the way. If file_path is already an absolute path, then output_directory is ignored. Arguments: file_path: File name to

(file_path: StrPath, output_directory: StrPath | None = None)

Source from the content-addressed store, hash-verified

139
140
141def get_and_create_path(file_path: StrPath, output_directory: StrPath | None = None) -> str:
142 """Get & Create Path: Gets and returns the full/absolute path to file_path
143 in the specified output_directory if set, creating any required directories
144 along the way.
145
146 If file_path is already an absolute path, then output_directory is ignored.
147
148 Arguments:
149 file_path: File name to get path for. If file_path is an absolute
150 path (e.g. starts at a drive/root), no modification of the path
151 is performed, only ensuring that all output directories are created.
152 output_dir: An optional output directory to override the
153 directory of file_path if it is relative to the working directory.
154
155 Returns:
156 Full path to output file suitable for writing.
157
158 """
159 file_path = os.fspath(file_path)
160 # If an output directory is defined and the file path is a relative path, open
161 # the file handle in the output directory instead of the working directory.
162 if output_directory is not None and not os.path.isabs(file_path):
163 file_path = os.path.join(os.fspath(output_directory), file_path)
164 # Now that file_path is an absolute path, let's make sure all the directories
165 # exist for us to start writing files there.
166 os.makedirs(os.path.split(os.path.abspath(file_path))[0], exist_ok=True)
167 return file_path
168
169
170##

Callers 10

runMethod · 0.90
save_imagesFunction · 0.90
save_htmlFunction · 0.90
save_qpFunction · 0.90
list_scenesFunction · 0.90
save_edlFunction · 0.90
save_fcpFunction · 0.90
save_otioFunction · 0.90
_save_statsFunction · 0.90
init_loggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected