From 44fe43a32642f93508e093dfc774fdf8a1bc7096 Mon Sep 17 00:00:00 2001 From: "yaxing.chen" Date: Thu, 3 Dec 2020 15:51:15 +0800 Subject: [PATCH] add longpath enable --- longpathenable.bat | 8 ++++++++ platformio_support_package.yaml | 2 +- script.py | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 longpathenable.bat diff --git a/longpathenable.bat b/longpathenable.bat new file mode 100644 index 00000000..7b686d5f --- /dev/null +++ b/longpathenable.bat @@ -0,0 +1,8 @@ +%1 %2 +@echo off +ver|find "5.">nul&&goto :admin +mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :admin","","runas",1)(window.close)&goto :eof +:admin +reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /f /d 1 +:eof + diff --git a/platformio_support_package.yaml b/platformio_support_package.yaml index 37f6de9c..3464c85b 100644 --- a/platformio_support_package.yaml +++ b/platformio_support_package.yaml @@ -1,6 +1,6 @@ --- yaml_version: 1 -pkg_version: 5.0.3.4 +pkg_version: 5.0.3.5 pkg_vendor: RealThread pkg_type: ThirdParty_Support_Packages name: PlatformIO diff --git a/script.py b/script.py index 8a0fe96f..09205505 100644 --- a/script.py +++ b/script.py @@ -114,6 +114,7 @@ def make_platformio(self): if len(sys.argv) > 2: + builder = PlatformioBuilder() rt_studio_version = sys.argv[1] if "global" in str(sys.argv[2]).lower(): is_studio_global_version = True @@ -121,8 +122,21 @@ def make_platformio(self): is_studio_global_version = False print("rt_studio_version: " + str(rt_studio_version)) if rt_studio_version >= "2.0.0": + result = os.popen("""reg query HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FileSystem /v LongPathsEnabled""") + if "1" in result.read().strip().split(" ")[-1]: + print("Long path support has enabled") + else: + print("Long path support has not enabled") + print("Enable windows long path support...") + bat_path = builder.current_folder.joinpath("longpathenable.bat").as_posix() + os.system(str(bat_path)) + result = os.popen("""reg query HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FileSystem /v LongPathsEnabled""") + if "1" in result.read().strip().split(" ")[-1]: + print("Long path support has enabled") + else: + print("Enable long path support fail.") + sys.exit(1) if is_studio_global_version: - builder = PlatformioBuilder() builder.make_platformio() else: builder = PlatformioBuilder()