Commit 0a453497 authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

fix #19: add extension for executables

parent fdb6705f
......@@ -40,6 +40,12 @@ from otb.OTBAlgorithm import OTBAlgorithm
pluginPath = os.path.split(os.path.dirname(__file__))[0]
def otb_exe_file(f):
if os.name == 'nt':
return f + '.exe'
else:
return f
class OTBAlgorithmProvider(QgsProcessingProvider):
def __init__(self):
......@@ -87,7 +93,7 @@ class OTBAlgorithmProvider(QgsProcessingProvider):
dfile = os.path.join(descr_folder, app_name + '.txt')
isValid = True
if not os.path.exists(dfile):
cmdlist = [os.path.join(folder,'bin', 'otbQgisDescriptor'),
cmdlist = [os.path.join(folder,'bin', otb_exe_file('otbQgisDescriptor')),
app_name, app_dir,
descr_folder + '/' ]
commands = ' '.join(cmdlist)
......@@ -105,9 +111,9 @@ class OTBAlgorithmProvider(QgsProcessingProvider):
return
if not v or not os.path.exists(v):
return
if not os.path.exists(os.path.join(v,'bin', 'otbApplicationLauncherCommandLine')):
if not os.path.exists(os.path.join(v,'bin', otb_exe_file('otbApplicationLauncherCommandLine'))):
self.setActive(False)
raise ValueError(self.tr("Cannot find '{}'. OTB will be disabled".format(os.path.join(v,'bin', 'otbApplicationLauncherCommandLine'))))
raise ValueError(self.tr("Cannot find '{}'. OTB will be disabled".format(os.path.join(v,'bin', otb_exe_file('otbApplicationLauncherCommandLine')))))
# install_dir #otb issue 1557
version_file = os.path.join(v, 'share', 'doc', 'OTB-6.6', 'VERSION')
......@@ -143,12 +149,11 @@ class OTBAlgorithmProvider(QgsProcessingProvider):
# print("GEOTIFF_CSV", geotiff_csv_dir)
first_line = '#!/bin/sh'
export_cmd = 'export '
otb_app_launcher = os.path.join(v, 'bin', 'otbApplicationLauncherCommandLine')
otb_app_launcher = os.path.join(v, 'bin', otb_exe_file('otbApplicationLauncherCommandLine'))
cli_filepath = os.path.join(QgsApplication.qgisSettingsDirPath(), 'processing', 'qgis_otb_cli')
if os.name == 'nt':
first_line = '@echo off'
export_cmd = 'set '
otb_app_launcher = os.path.join(v, 'bin', 'otbApplicationLauncherCommandLine.exe')
cli_filepath = os.path.join(QgsApplication.qgisSettingsDirPath(), 'processing', 'qgis_otb_cli.bat')
if not os.path.exists(cli_filepath) or not os.path.isfile(cli_filepath):
with open(cli_filepath, 'w') as otb_cli_file:
......
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