Skip to content

Commit

Permalink
[C++] Update to new Mediacreation view usage
Browse files Browse the repository at this point in the history
New Mediacreation uses optional for its property access.

Signed-off-by: Elliot Morris <[email protected]>
  • Loading branch information
elliotcmorris committed Mar 22, 2024
1 parent dadfb7d commit 0352c9d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,19 @@ std::string resolveToPath(const openassetio::hostApi::ManagerPtr &manager,
static constexpr std::string_view kFileURLScheme{"file://"};
static constexpr std::size_t kProtocolSize = kFileURLScheme.size();

openassetio::Str url = LocatableContentTrait(traitsData).getLocation();
if (url.rfind(kFileURLScheme, 0) == openassetio::Str::npos) {
std::string msg = "Only file URLs are supported: ";
msg += url;
throw std::runtime_error(msg);
if (auto url = LocatableContentTrait(traitsData).getLocation(){
if (url.rfind(kFileURLScheme, 0) == openassetio::Str::npos) {
std::string msg = "Only file URLs are supported: ";
msg += url;
throw std::runtime_error(msg);
}

// TODO(tc): Decode % escape sequences properly
replaceAllInString(url, "%20", " ");
return url.substr(kProtocolSize);
}

// TODO(tc): Decode % escape sequences properly
replaceAllInString(url, "%20", " ");
return url.substr(kProtocolSize);
return "";
}

/**
Expand Down

0 comments on commit 0352c9d

Please sign in to comment.