Commit d43b2950 authored by Rashad Kanavath's avatar Rashad Kanavath

check for valid otb folder and read version

parent 5b5a1f15
......@@ -99,6 +99,24 @@ class OTBAlgorithmProvider(QgsProcessingProvider):
if not v or not os.path.exists(v):
if not os.path.exists(os.path.join(v,'bin', 'otbApplicationLauncherCommandLine')):
raise ValueError("Cannot find '{}'. OTB will be disabled".format(os.path.join(v,'bin', 'otbApplicationLauncherCommandLine'))))
# install_dir #otb issue 1557
version_file = os.path.join(v, 'share', 'doc', 'OTB-6.5', 'VERSION')
# build_dir
if os.path.isfile(version_file):
version_file = os.path.join(v, 'VERSION')
if os.path.isfile(version_file):
with open(version_file) as vf:
vlines = vf.readlines()
vlines = [l.strip() for l in vlines]
vline = vlines[0]
if 'OTB Version:' in vline:
self.version = vline.split(':')[1]
ProcessingConfig.setSettingValue(OTBUtils.VERSION, self.version)
env_profile = os.path.join(v, 'otbenv.profile')
if os.path.isfile(env_profile):
lines = None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment