Skip to content

Commit

Permalink
add longpath enable
Browse files Browse the repository at this point in the history
  • Loading branch information
dh-04 committed Dec 3, 2020
1 parent d7991ce commit 44fe43a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
8 changes: 8 additions & 0 deletions longpathenable.bat
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion platformio_support_package.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 15 additions & 1 deletion script.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,29 @@ 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
else:
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()
Expand Down

0 comments on commit 44fe43a

Please sign in to comment.