Skip to content

Commit

Permalink
WIP 6
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Jul 26, 2021
1 parent c738c7a commit cc2238f
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/gridcoin/upgrade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,34 @@ void Upgrade::CleanupBlockchainData()
{
fs::path CleanupPath = GetDataDir();

// This is required because of problems with junction point handling in the boost filesystem library. Please see
// https://github.com/boostorg/filesystem/issues/125. We are not quite ready to switch over to std::filesystem yet.
// 1. I don't know whether the issue is fixed there, and
// 2. Not all C++17 compilers have the filesystem headers, since this was merged from boost in 2017.
//
// I don't believe it is very common for Windows users to redirect the Gridcoin data directory with a junction point,
// but it is certainly possible. We should handle it as gracefully as possible.
if (fs::is_symlink(CleanupPath))
{
LogPrintf("INFO: %s: Data directory is a symlink. True path is %s.",
__func__, fs::read_symlink(CleanupPath).string());
LogPrintf("INFO: %s: Data directory is a symlink.",
__func__);

CleanupPath = fs::read_symlink(CleanupPath);
try
{
LogPrintf("INFO: %s: True path for the symlink is %s.", __func__, fs::read_symlink(CleanupPath).string());

CleanupPath = fs::read_symlink(CleanupPath);
}
catch (fs::filesystem_error &ex)
{
error("%s: The data directory symlink or junction point cannot be resolved to the true canonical path. "
"This can happen on Windows. Please change the data directory specified to the actual true path "
"using the -datadir=<path> option and try again.", __func__);

DownloadStatus.SetCleanupBlockchainDataFailed(true);

return;
}
}

unsigned int total_items = 0;
Expand Down

0 comments on commit cc2238f

Please sign in to comment.