Skip to content

Commit

Permalink
Merge pull request #14122 from afedchin/winrt-catch
Browse files Browse the repository at this point in the history
win10: filesystem - catch possible exception
  • Loading branch information
afedchin committed Jun 28, 2018
2 parents 0c7dd0b + 58eecb5 commit 6ebd845
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions xbmc/platform/win10/filesystem/WinLibraryFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,28 @@ bool CWinLibraryFile::IsInAccessList(const CURL& url)
static std::string localPath;
static std::string packagePath;

if (localPath.empty())
localPath = FromW(ApplicationData::Current().LocalFolder().Path().c_str());
try
{
if (localPath.empty())
localPath = FromW(ApplicationData::Current().LocalFolder().Path().c_str());

if (packagePath.empty())
packagePath = FromW(Package::Current().InstalledLocation().Path().c_str());
if (packagePath.empty())
packagePath = FromW(Package::Current().InstalledLocation().Path().c_str());

// don't check files inside local folder and installation folder
if ( StringUtils::StartsWithNoCase(url.Get(), localPath)
|| StringUtils::StartsWithNoCase(url.Get(), packagePath))
return false;
// don't check files inside local folder and installation folder
if ( StringUtils::StartsWithNoCase(url.Get(), localPath)
|| StringUtils::StartsWithNoCase(url.Get(), packagePath))
return false;

return IsInList(url, StorageApplicationPermissions::FutureAccessList())
|| IsInList(url, StorageApplicationPermissions::MostRecentlyUsedList());
return IsInList(url, StorageApplicationPermissions::FutureAccessList())
|| IsInList(url, StorageApplicationPermissions::MostRecentlyUsedList());
}
catch (const winrt::hresult_error& ex)
{
std::string strError = FromW(ex.message().c_str());
CLog::LogF(LOGERROR, "unexpected error occurs during WinRT API call: {}", strError);
}
return false;
}

bool CWinLibraryFile::OpenIntenal(const CURL &url, FileAccessMode mode)
Expand Down

0 comments on commit 6ebd845

Please sign in to comment.