Merge branch 'fix/createPageDir' into 'dev'
Fix/create page dir See merge request p2406187/sae201!36
This commit is contained in:
commit
9a12e8e877
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
||||
*.json
|
||||
*.html
|
||||
|
||||
data/HTML-exports
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
## and Ignore Qt objects and libs.
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
int MainWindow::indexPath = 0;
|
||||
|
||||
@ -198,10 +199,12 @@ void MainWindow::exportHTMLMap(int index)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QDir dir;
|
||||
dir.mkdir("./data/HTML-exports");
|
||||
dir.mkdir("./data/HTML-exports/pages");
|
||||
|
||||
QString safeName = p->getName().simplified().replace(" ", "_");
|
||||
std::string fileName = "./pages/parcours_" + safeName.toStdString() + ".html";
|
||||
std::string fileName = "./data/HTML-exports/pages/parcours_" + safeName.toStdString() + ".html";
|
||||
std::ofstream file(fileName);
|
||||
|
||||
if (!file.is_open()) {
|
||||
@ -331,10 +334,10 @@ margin-bottom:20px;
|
||||
QString imagePath = p->getImage();
|
||||
QFileInfo fileInfo(imagePath);
|
||||
QString imageName = fileInfo.fileName();
|
||||
QString destPath = "./pages/images/" + imageName;
|
||||
QString destPath = "../data/HTML-exports/pages/images/" + imageName;
|
||||
|
||||
// Crée le dossier images s’il n’existe pas
|
||||
QDir().mkpath("./pages/images");
|
||||
QDir().mkpath("./data/HTML-exports/pages/images");
|
||||
|
||||
// Copie l’image dans le dossier pages/images
|
||||
QFile::copy(imagePath, destPath);
|
||||
@ -1056,7 +1059,7 @@ void MainWindow::on_actionExit_triggered() { QApplication::quit(); }
|
||||
|
||||
|
||||
void MainWindow::openIndexSite() {
|
||||
QString filePath = "index.html";
|
||||
QString filePath = "./data/HTML-exports/index.html";
|
||||
QFileInfo fileInfo(filePath);
|
||||
|
||||
if (fileInfo.exists() && fileInfo.isFile()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user