Changeset 86860 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 11, 2020 12:57:16 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r86848 r86860 246 246 void UIAcquirePublicKeyDialog::prepareEditorContents() 247 247 { 248 loadFileContents(gEDataManager->cloudConsolePublicKeyPath(), true /* ignore errors */); 248 /* Try to load last remembered file contents: */ 249 if (!loadFileContents(gEDataManager->cloudConsolePublicKeyPath(), true /* ignore errors */)) 250 { 251 /* We have failed to load file mentioned in extra-data, now we have 252 * to check whether file present in one of default paths: */ 253 QStringList paths; 254 #ifdef VBOX_WS_WIN 255 // WORKAROUND: 256 // There is additional default path on Windows: 257 paths << QDir(QDir::homePath()).absoluteFilePath("oci"); 258 #endif 259 paths << QDir(QDir::homePath()).absoluteFilePath(".ssh"); 260 261 /* Look for required file in one of those paths: */ 262 QString strAbsoluteFilePathWeNeed; 263 foreach (const QString &strPath, paths) 264 { 265 /* Gather possible file names, there can be few of them: */ 266 const QStringList fileNames = QStringList() << "id_rsa" << "id_rsa.pub"; 267 /* For each file name we have to: */ 268 foreach (const QString &strFileName, fileNames) 269 { 270 /* Compose absolute file path: */ 271 const QString strAbsoluteFilePath = QDir(strPath).absoluteFilePath(strFileName); 272 /* If that file exists, we are referring it: */ 273 if (QFile::exists(strAbsoluteFilePath)) 274 { 275 strAbsoluteFilePathWeNeed = strAbsoluteFilePath; 276 break; 277 } 278 } 279 /* Break early if we have found something: */ 280 if (!strAbsoluteFilePathWeNeed.isEmpty()) 281 break; 282 } 283 284 /* Try to open file if it was really found: */ 285 if (!strAbsoluteFilePathWeNeed.isEmpty()) 286 loadFileContents(strAbsoluteFilePathWeNeed, true /* ignore errors */); 287 } 249 288 } 250 289
Note:
See TracChangeset
for help on using the changeset viewer.