From fb79c65e70ea4e4e21f30d714542daae957e96b5 Mon Sep 17 00:00:00 2001 From: Marco Callieri Date: Tue, 21 Feb 2017 15:47:57 +0100 Subject: [PATCH] Added a check for writable folder in Screened Poisson and VCG Merging As Screened Poisson and VCG Merging need to save temporary files, the current folder should be writable, If it is not so, fail, and give a proper error decription --- src/meshlabplugins/filter_plymc/filter_plymc.cpp | 8 ++++++++ .../filter_screened_poisson/filter_screened_poisson.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/meshlabplugins/filter_plymc/filter_plymc.cpp b/src/meshlabplugins/filter_plymc/filter_plymc.cpp index a9abaefbb..910966920 100644 --- a/src/meshlabplugins/filter_plymc/filter_plymc.cpp +++ b/src/meshlabplugins/filter_plymc/filter_plymc.cpp @@ -121,6 +121,14 @@ bool PlyMCPlugin::applyFilter(QAction *filter, MeshDocument &md, RichParameterSe { srand(time(NULL)); + //check if folder is writable + QFileInfo fi(QDir::currentPath(),"file.tmp"); + if (!fi.isWritable()) + { + Log("ERROR - current folder is not writable. VCG Merging need to save intermediate files in the current working folder. Project and meshes must be in a write-enabled folder"); + return false; + } + tri::PlyMC > pmc; pmc.MP.setCacheSize(64); tri::PlyMC >::Parameter &p = pmc.p; diff --git a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp index 42d969fb7..85cc91597 100644 --- a/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp +++ b/src/meshlabplugins/filter_screened_poisson/filter_screened_poisson.cpp @@ -581,6 +581,14 @@ bool FilterScreenedPoissonPlugin::applyFilter( const QString& filterName,MeshDoc { if (filterName == "Surface Reconstruction: Screened Poisson") { + //check if folder is writable + QFileInfo fi(QDir::currentPath(), "file.tmp"); + if (!fi.isWritable()) + { + Log("ERROR - current folder is not writable. VCG Merging need to save intermediate files in the current working folder. Project and meshes must be in a write-enabled folder"); + return false; + } + PoissonParam pp; pp.MaxDepthVal = env.evalInt("depth"); pp.FullDepthVal = env.evalInt("fullDepth");