Warn on non-safe path

This commit is contained in:
Lubos Lenco 2017-09-08 14:07:41 +02:00
parent ea4347e4d2
commit 19d4621789
2 changed files with 23 additions and 5 deletions

View file

@ -606,6 +606,8 @@ class ArmoryBuildProjectButton(bpy.types.Operator):
if not arm.utils.check_engine(self):
return {"CANCELLED"}
arm.utils.check_projectpath(self)
make_renderer.check_default()
wrd = bpy.data.worlds['Arm']
@ -644,6 +646,10 @@ class ArmoryPublishProjectButton(bpy.types.Operator):
if not arm.utils.check_engine(self):
return {"CANCELLED"}
self.report({'INFO'}, 'Publishing project, check console for details.')
arm.utils.check_projectpath(self)
make_renderer.check_default()
wrd = bpy.data.worlds['Arm']
@ -680,7 +686,6 @@ class ArmoryPublishProjectButton(bpy.types.Operator):
print('Android Studio project files are being exported to ' + files_path + '-build/' + arm.utils.safestr(wrd.arm_project_name))
else:
print('Makefiles are being exported to ' + files_path + '-build')
self.report({'INFO'}, 'Publishing project, check console for details.')
return{'FINISHED'}
class ArmoryPatchButton(bpy.types.Operator):

View file

@ -307,18 +307,31 @@ def check_saved(self):
return False
return True
def check_sdkpath(self):
s = get_sdk_path()
def check_path(s):
for c in r'[];><&*%=+@!#^()|?^':
if c in s:
self.report({"ERROR"}, "SDK path '{0}' contains special characters. Please move SDK to different path for now.".format(s))
return False
for c in s:
if ord(c) > 127:
self.report({"ERROR"}, "SDK path '{0}' contains special characters. Please move SDK to different path for now.".format(s))
return False
return True
def check_sdkpath(self):
s = get_sdk_path()
if check_path(s) == False:
self.report({"ERROR"}, "SDK path '{0}' contains special characters. Please move SDK to different path for now.".format(s))
return False
else:
return True
def check_projectpath(self):
s = get_fp()
if check_path(s) == False:
self.report({"WARNING"}, "Project path '{0}' contains special characters, build process may fail.".format(s))
return False
else:
return True
def check_engine(self):
if bpy.context == None or bpy.context.scene == None:
return