managing tmp folder and update vcglib

This commit is contained in:
alemuntoni 2020-05-05 12:01:26 +02:00
parent 04e22a5779
commit 595f144f74
2 changed files with 17 additions and 9 deletions

View File

@ -100,15 +100,22 @@ bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md,
QDir currDir = QDir::current();
if (ID(filter) == FP_SCREENED_POISSON) {
//check if folder is writable
QTemporaryFile file("./_tmp_XXXXXX.tmp");
if (!file.open()) {
//Using tmp dir
QTemporaryDir tmpdir;
QTemporaryFile file(tmpdir.path());
if (!file.open()) { //if a file cannot be created in the tmp folder
Log("Warning - tmp folder is not writable.");
QTemporaryFile file2("./_tmp_XXXXXX.tmp"); //try to create a file in the meshlab folder
if (!file2.open()){ //if a file cannot be created in the tmp and in the meshlab folder, we cannot run the filter
Log("Warning - current folder is not writable. Screened Poisson Merging needs to save intermediate files in the tmp working folder. Project and meshes must be in a write-enabled folder. Please save your data in a suitable folder before applying.");
errorMessage = "current and tmp folder are not writable.<br> Screened Poisson Merging needs to save intermediate files in the current working folder.<br> Project and meshes must be in a write-enabled folder.<br> Please save your data in a suitable folder before applying.";
return false;
}
}
else { //if the tmp folder is writable, we will use it
currDirChanged=true;
QTemporaryDir tmpdir;
QDir::setCurrent(tmpdir.path());
Log("Warning - current folder is not writable. Screened Poisson Merging needs to save intermediate files in the current working folder. Project and meshes must be in a write-enabled folder. Please save your data in a suitable folder before applying.");
//errorMessage = "current folder is not writable.<br> Screened Poisson Merging needs to save intermediate files in the current working folder.<br> Project and meshes must be in a write-enabled folder.<br> Please save your data in a suitable folder before applying.";
//return false;
}
PoissonParam<Scalarm> pp;
@ -174,7 +181,8 @@ bool FilterScreenedPoissonPlugin::applyFilter(QAction* filter, MeshDocument& md,
pm->UpdateBoxAndNormals();
md.setVisible(pm->id(),true);
md.setCurrentMesh(pm->id());
if(currDirChanged) QDir::setCurrent(currDir.path());
if(currDirChanged)
QDir::setCurrent(currDir.path());
return true;
}
return false;

2
vcglib

@ -1 +1 @@
Subproject commit f7871eed2d54bee704b9f66dc538c921602323cb
Subproject commit d657112c134cf99932c9d0dfad98a213575c12dd