diff --git a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp
index 17f9f4eb2..4c6904451 100644
--- a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp
+++ b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp
@@ -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.
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.";
+ 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.
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.";
- //return false;
}
PoissonParam 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;
diff --git a/vcglib b/vcglib
index f7871eed2..d657112c1 160000
--- a/vcglib
+++ b/vcglib
@@ -1 +1 @@
-Subproject commit f7871eed2d54bee704b9f66dc538c921602323cb
+Subproject commit d657112c134cf99932c9d0dfad98a213575c12dd