@@ -107,8 +107,19 @@ QVector<ZipEntry> createDebugArchiveFileList()
107
107
return list;
108
108
}
109
109
110
- void createDebugArchive (const QString &filename)
110
+ bool createDebugArchive (const QString &filename)
111
111
{
112
+ const auto fileInfo = QFileInfo (filename);
113
+ const auto dirInfo = QFileInfo (fileInfo.dir ().absolutePath ());
114
+ if (!dirInfo.isWritable ()) {
115
+ QMessageBox::critical (
116
+ nullptr ,
117
+ QObject::tr (" Failed to create debug archive" ),
118
+ QObject::tr (" Could not create debug archive in selected location!" )
119
+ );
120
+ return false ;
121
+ }
122
+
112
123
const auto entries = createDebugArchiveFileList ();
113
124
114
125
KZip zip (filename);
@@ -127,7 +138,9 @@ void createDebugArchive(const QString &filename)
127
138
zip.prepareWriting (" __nextcloud_client_buildinfo.txt" , {}, {}, buildInfo.size ());
128
139
zip.writeData (buildInfo, buildInfo.size ());
129
140
zip.finishWriting (buildInfo.size ());
141
+ return true ;
130
142
}
143
+
131
144
}
132
145
133
146
namespace OCC {
@@ -498,13 +511,24 @@ void GeneralSettings::slotIgnoreFilesEditor()
498
511
499
512
void GeneralSettings::slotCreateDebugArchive ()
500
513
{
501
- const auto filename = QFileDialog::getSaveFileName (this , tr (" Create Debug Archive" ), QString (), tr (" Zip Archives" ) + " (*.zip)" );
514
+ const auto filename = QFileDialog::getSaveFileName (
515
+ this ,
516
+ tr (" Create Debug Archive" ),
517
+ QStandardPaths::writableLocation (QStandardPaths::DocumentsLocation),
518
+ tr (" Zip Archives" ) + " (*.zip)"
519
+ );
520
+
502
521
if (filename.isEmpty ()) {
503
522
return ;
504
523
}
505
524
506
- createDebugArchive (filename);
507
- QMessageBox::information (this , tr (" Debug Archive Created" ), tr (" Debug archive is created at %1" ).arg (filename));
525
+ if (createDebugArchive (filename)) {
526
+ QMessageBox::information (
527
+ this ,
528
+ tr (" Debug Archive Created" ),
529
+ tr (" Debug archive is created at %1" ).arg (filename)
530
+ );
531
+ }
508
532
}
509
533
510
534
void GeneralSettings::slotShowLegalNotice ()
0 commit comments