Change html export path
This commit is contained in:
parent
2018375062
commit
37276b5d90
@ -21,6 +21,7 @@
|
|||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
int MainWindow::indexPath = 0;
|
int MainWindow::indexPath = 0;
|
||||||
|
|
||||||
@ -198,10 +199,12 @@ void MainWindow::exportHTMLMap(int index)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDir dir;
|
||||||
|
dir.mkdir("./data/HTML-exports");
|
||||||
|
dir.mkdir("./data/HTML-exports/pages");
|
||||||
|
|
||||||
QString safeName = p->getName().simplified().replace(" ", "_");
|
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);
|
std::ofstream file(fileName);
|
||||||
|
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
@ -331,10 +334,10 @@ margin-bottom:20px;
|
|||||||
QString imagePath = p->getImage();
|
QString imagePath = p->getImage();
|
||||||
QFileInfo fileInfo(imagePath);
|
QFileInfo fileInfo(imagePath);
|
||||||
QString imageName = fileInfo.fileName();
|
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
|
// 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
|
// Copie l’image dans le dossier pages/images
|
||||||
QFile::copy(imagePath, destPath);
|
QFile::copy(imagePath, destPath);
|
||||||
@ -1056,7 +1059,7 @@ void MainWindow::on_actionExit_triggered() { QApplication::quit(); }
|
|||||||
|
|
||||||
|
|
||||||
void MainWindow::openIndexSite() {
|
void MainWindow::openIndexSite() {
|
||||||
QString filePath = "index.html";
|
QString filePath = "./data/HTML-exports/index.html";
|
||||||
QFileInfo fileInfo(filePath);
|
QFileInfo fileInfo(filePath);
|
||||||
|
|
||||||
if (fileInfo.exists() && fileInfo.isFile()) {
|
if (fileInfo.exists() && fileInfo.isFile()) {
|
||||||
|
|||||||
2
web.cpp
2
web.cpp
@ -8,7 +8,7 @@ Web::Web(const QList<Path*>& list) : list(list)
|
|||||||
|
|
||||||
void Web::siteHtml()
|
void Web::siteHtml()
|
||||||
{
|
{
|
||||||
std::ofstream file("index.html");
|
std::ofstream file("./data/HTML-exports/index.html");
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
qWarning("Impossible d'ouvrir le fichier index.html");
|
qWarning("Impossible d'ouvrir le fichier index.html");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user