From dcc1933d2b88166f3cf32e05a1749ab3585a747b Mon Sep 17 00:00:00 2001 From: Lubos Date: Wed, 31 Jan 2018 02:51:09 +0100 Subject: [PATCH] Fixed paths --- blender/arm/props_traits.py | 4 +++- blender/arm/utils.py | 38 ++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/blender/arm/props_traits.py b/blender/arm/props_traits.py index 9efb02a8..ca982990 100755 --- a/blender/arm/props_traits.py +++ b/blender/arm/props_traits.py @@ -244,13 +244,15 @@ class ArmEditScriptButton(bpy.types.Operator): sdk_path = arm.utils.get_sdk_path() if arm.utils.get_os() == 'win': - arm.utils.kode_studio_mklink(sdk_path) + arm.utils.kode_studio_mklink_win(sdk_path) kode_path = sdk_path + '/win32/Kode Studio.exe' subprocess.Popen([kode_path, arm.utils.get_fp(), hx_path]) elif arm.utils.get_os() == 'mac': + arm.utils.kode_studio_mklink_mac(sdk_path) kode_path = '"' + sdk_path + '/Kode Studio.app/Contents/MacOS/Electron"' subprocess.Popen([kode_path + ' "' + arm.utils.get_fp() + '" "' + hx_path + '"'], shell=True) else: + arm.utils.kode_studio_mklink_linux(sdk_path) kode_path = sdk_path + '/linux64/kodestudio' subprocess.Popen([kode_path, arm.utils.get_fp(), hx_path]) diff --git a/blender/arm/utils.py b/blender/arm/utils.py index b013823a..f74f3075 100755 --- a/blender/arm/utils.py +++ b/blender/arm/utils.py @@ -130,13 +130,7 @@ def get_node_path(): def get_kha_path(): if os.path.exists('Kha'): return 'Kha' - - if get_os() == 'win': - return get_sdk_path() + '/Kha' # Using symlink on Windows - elif get_os() == 'mac': - return get_sdk_path() + '/Kode Studio.app/Contents/Resources/app/extensions/kha/Kha' - else: - return get_sdk_path() + '/linux64/resources/app/extensions/kha/Kha' + return get_sdk_path() + '/Kha' def get_haxe_path(): if get_os() == 'win': @@ -155,10 +149,10 @@ def krom_paths(): krom_location = sdk_path + '/Krom/win32' # Using symlink on Windows krom_path = krom_location + '/Krom.exe' elif arm.utils.get_os() == 'mac': - krom_location = sdk_path + '/Kode Studio.app/Contents/Resources/app/extensions/krom/Krom/macos/Krom.app/Contents/MacOS' + krom_location = sdk_path + '/Krom/macos/Krom.app/Contents/MacOS' krom_path = krom_location + '/Krom' else: - krom_location = sdk_path + '/linux64/resources/app/extensions/krom/Krom/linux' + krom_location = sdk_path + '/Krom/linux' krom_path = krom_location + '/Krom' return krom_location, krom_path @@ -444,7 +438,7 @@ def is_bone_animation_enabled(bobject): def export_bone_data(bobject): return bobject.find_armature() and is_bone_animation_enabled(bobject) and bpy.data.worlds['Arm'].arm_skin.startswith('GPU') -def kode_studio_mklink(sdk_path): +def kode_studio_mklink_win(sdk_path): # Fight long-path issues on Windows if not os.path.exists(sdk_path + '/win32/resources/app/extensions/kha/Kha'): source = sdk_path + '/win32/resources/app/extensions/kha/Kha' @@ -455,17 +449,39 @@ def kode_studio_mklink(sdk_path): target = sdk_path + '/Krom' subprocess.check_call('mklink /J "%s" "%s"' % (source, target), shell=True) +def kode_studio_mklink_linux(sdk_path): + if not os.path.exists(sdk_path + '/linux64/resources/app/extensions/kha/Kha'): + source = sdk_path + '/linux64/resources/app/extensions/kha/Kha' + target = sdk_path + '/Kha' + subprocess.check_call('ln -s "%s" "%s"' % (target, source), shell=True) + if not os.path.exists(sdk_path + '/linux64/resources/app/extensions/krom/Krom'): + source = sdk_path + '/linux64/resources/app/extensions/krom/Krom' + target = sdk_path + '/Krom' + subprocess.check_call('ln -s "%s" "%s"' % (target, source), shell=True) + +def kode_studio_mklink_mac(sdk_path): + if not os.path.exists(sdk_path + '/Kode Studio.app/Contents/Resources/app/extensions/kha/Kha'): + source = sdk_path + '/Kode Studio.app/Contents/Resources/app/extensions/kha/Kha' + target = sdk_path + '/Kha' + subprocess.check_call('ln -s "%s" "%s"' % (target, source), shell=True) + if not os.path.exists(sdk_path + '/Kode Studio.app/Contents/Resources/app/extensions/krom/Krom'): + source = sdk_path + '/Kode Studio.app/Contents/Resources/app/extensions/krom/Krom' + target = sdk_path + '/Krom' + subprocess.check_call('ln -s "%s" "%s"' % (target, source), shell=True) + def kode_studio(): sdk_path = arm.utils.get_sdk_path() project_path = arm.utils.get_fp() if arm.utils.get_os() == 'win': - kode_studio_mklink(sdk_path) + kode_studio_mklink_win(sdk_path) kode_path = sdk_path + '/win32/Kode Studio.exe' subprocess.Popen([kode_path, arm.utils.get_fp()]) elif arm.utils.get_os() == 'mac': + kode_studio_mklink_macos(sdk_path) kode_path = '"' + sdk_path + '/Kode Studio.app/Contents/MacOS/Electron"' subprocess.Popen([kode_path + ' "' + arm.utils.get_fp() + '"'], shell=True) else: + kode_studio_mklink_linux(sdk_path) kode_path = sdk_path + '/linux64/kodestudio' subprocess.Popen([kode_path, arm.utils.get_fp()])