Skip to content

ociocheck to check OpenColorIO library version first#2310

Draft
meimchu wants to merge 3 commits into
AcademySoftwareFoundation:mainfrom
meimchu:feature/config_exists_check
Draft

ociocheck to check OpenColorIO library version first#2310
meimchu wants to merge 3 commits into
AcademySoftwareFoundation:mainfrom
meimchu:feature/config_exists_check

Conversation

@meimchu
Copy link
Copy Markdown
Contributor

@meimchu meimchu commented May 13, 2026

The idea behind this PR originated with me using ociocheck and getting stuck with config read error (#2303). So I just wanted clearer error message when the error was due to the file path provided being non-existent. Upon looking at the existing issues, I noticed there is an issue about removing pystring dependency (#2256). So I took this opportunity to get started by adding PathUtils::IsPathAbs(), PathUtils::NormalizePath()... etc with standard library filesystem and using them in Config. Also a change to ExceptionMissingFile raised if file does not exist. (Can revert back to just raise Exception if it's causing too much API change)

I would appreciate if @KevinJW has any thought about this as a starting point and the right track. Thank you!

meimchu added 3 commits May 13, 2026 00:01
Signed-off-by: Mei Chu <meimchu@gmail.com>
Signed-off-by: Mei Chu <meimchu@gmail.com>
Signed-off-by: Mei Chu <meimchu@gmail.com>
@meimchu meimchu marked this pull request as draft May 13, 2026 07:57
if (!filename || !*filename)
{
throw ExceptionMissingFile ("The config filepath is missing.");
throw ExceptionMissingFile("The config filepath is missing.");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably OK for now, but it is worth noting that as you highlighted in the issue this condition isn't quite the same as a missing file. ideally we'd have a different type for this.

// working directory must be an absolute path.
const char * workingDirectory = getWorkingDir();
if ((workingDirectory && !workingDirectory[0]) || !pystring::os::path::isabs(workingDirectory))
if ((workingDirectory && !workingDirectory[0]) || !IsPathAbs(workingDirectory))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My gut suggests we should deal with the switch away from the pystring implementation as a separate issue to cleaning up the error messages. Changing the implementation to use std::filesystem could have more subtle issues

return (!hash.empty());
}

bool FileExists(const std::string & filename)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an example of the subtlety When comparing this function with the other overload

bool FileExists(const std::string & filename, const Context & context)

Shows a much more complicated implementation which immediately makes me wonder why. Should we be dealing with the IOProxy here or not, if not then should the function have a different name? or at least a clear documentation stating why etc.

At this point I have not reasoned this through as I don't have the understanding of the IOProxy workings without studying it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants