summaryrefslogtreecommitdiff
path: root/view/sharedcache
diff options
context:
space:
mode:
Diffstat (limited to 'view/sharedcache')
-rw-r--r--view/sharedcache/core/SharedCache.cpp32
-rw-r--r--view/sharedcache/core/SharedCacheView.cpp6
2 files changed, 32 insertions, 6 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index bfb10d90..0b8653d7 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -553,6 +553,19 @@ bool CacheProcessor::ProcessFileCache(SharedCache& cache)
std::string baseFilePath = m_view->GetFile()->GetOriginalFilename();
std::string baseFileName = BaseFileName(baseFilePath);
+ // If we don't have an original file path, prompt the user to select one.
+ if (baseFilePath.empty())
+ {
+ if (!GetOpenFileNameInput(baseFilePath, "Please select the base shared cache file"))
+ {
+ // User did not give a file, tell them that we will try and scan the file directory.
+ m_logger->LogWarn("Failed to get original file path, will try and scan the file directory.");
+ }
+ // Update so next load we don't need to prompt the user.
+ // TODO: What happens for a remote project? This will point at what exactly?
+ m_view->GetFile()->SetOriginalFilename(baseFilePath);
+ }
+
// Add this file to the entries
try
{
@@ -614,11 +627,24 @@ bool CacheProcessor::ProcessFileCache(SharedCache& cache)
bool CacheProcessor::ProcessProjectCache(SharedCache& cache)
{
auto baseProjectFile = m_view->GetFile()->GetProjectFile();
+ auto baseProjectFileFolder = baseProjectFile->GetFolder();
std::string baseFilePath = baseProjectFile->GetPathOnDisk();
std::string baseFileName = baseProjectFile->GetName();
// This will point to the path on disk for original non-bndb file.
std::string originalFilePath = m_view->GetFile()->GetOriginalFilename();
+ // If we don't have an original file path, prompt the user to select one.
+ if (originalFilePath.empty())
+ {
+ if (!GetOpenFileNameInput(originalFilePath, "Please select the base shared cache file"))
+ {
+ // User did not give a file, tell them that we will try and scan the project directory.
+ m_logger->LogWarn("Failed to get original file path, will try and scan the project directory.");
+ }
+ // Update so next load we don't need to prompt the user.
+ m_view->GetFile()->SetOriginalFilename(originalFilePath);
+ }
+
// Remove the .bndb extension if present ("dyld_shared_cache_arm64e.bndb" => "dyld_shared_cache_arm64e)
// TODO: This is a little annoying, we need to do this because the file accessor we have is separate
// TODO: from the view file accessor. If we either made it so that we can parse from the BNDB file accessor,
@@ -629,6 +655,12 @@ bool CacheProcessor::ProcessProjectCache(SharedCache& cache)
// Search for the backing file.
for (const auto& projectFile : baseProjectFile->GetProject()->GetFiles())
{
+ // Skip files not in the same folder.
+ auto projectFileFolder = projectFile->GetFolder();
+ if (baseProjectFileFolder && projectFileFolder)
+ if (baseProjectFileFolder->GetId() != projectFileFolder->GetId())
+ continue;
+
auto projectFilePath = projectFile->GetPathOnDisk();
auto projectFileName = projectFile->GetName();
if (projectFileName == baseFileName || projectFilePath == originalFilePath)
diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp
index 00caddd2..4ba44cc7 100644
--- a/view/sharedcache/core/SharedCacheView.cpp
+++ b/view/sharedcache/core/SharedCacheView.cpp
@@ -792,14 +792,8 @@ bool SharedCacheView::Init()
if (!result)
{
- // TODO: Prompt the user to select the primary cache file? We can still recover from here.
// Oh no, we failed to process the cache, this likely means the primary on-disk file was not able to be found.
logger->LogError("Failed to process cache, likely missing cache files.");
- // NOTE: An interaction handler headlessly could select yes to this, however for the purposes of this we will just let them continue by defualt.
- if (IsUIEnabled() && ShowMessageBox("Continue opening", "This shared cache file was unable to be processed, would you like to open without shared cache information?", YesNoButtonSet, QuestionIcon) != YesButton)
- return false;
- // Skip all the other shared cache stuff.
- return true;
}
// If we can't store all of our files for this cache in the accessor cache we might run into issues, warn the user.