MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / check

Method check

src/qt/intro.cpp:71–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void FreespaceChecker::check()
72{
73 QString dataDirStr = intro->getPathToCheck();
74 fs::path dataDir = GUIUtil::qstringToBoostPath(dataDirStr);
75 uint64_t freeBytesAvailable = 0;
76 int replyStatus = ST_OK;
77 QString replyMessage = tr("A new data directory will be created.");
78
79 /* Find first parent that exists, so that fs::space does not fail */
80 fs::path parentDir = dataDir;
81 fs::path parentDirOld = fs::path();
82 while(parentDir.has_parent_path() && !fs::exists(parentDir))
83 {
84 parentDir = parentDir.parent_path();
85
86 /* Check if we make any progress, break if not to prevent an infinite loop here */
87 if (parentDirOld == parentDir)
88 break;
89
90 parentDirOld = parentDir;
91 }
92
93 try {
94 freeBytesAvailable = fs::space(parentDir).available;
95 if(fs::exists(dataDir))
96 {
97 if(fs::is_directory(dataDir))
98 {
99 QString separator = "<code>" + QDir::toNativeSeparators("/") + tr("name") + "</code>";
100 replyStatus = ST_OK;
101 replyMessage = tr("Directory already exists. Add %1 if you intend to create a new directory here.").arg(separator);
102 } else {
103 replyStatus = ST_ERROR;
104 replyMessage = tr("Path already exists, and is not a directory.");
105 }
106 }
107 } catch (const fs::filesystem_error&)
108 {
109 /* Parent directory does not exist or is not accessible */
110 replyStatus = ST_ERROR;
111 replyMessage = tr("Cannot create data directory here.");
112 }
113 Q_EMIT reply(replyStatus, replyMessage, freeBytesAvailable);
114}
115
116
117Intro::Intro(QWidget *parent) :

Callers 2

ProcessMessageFunction · 0.45
ActivateBestChainStepMethod · 0.45

Calls 2

qstringToBoostPathFunction · 0.85
getPathToCheckMethod · 0.80

Tested by

no test coverage detected