Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tools/devel/longpath.py
169673 views
1
#!/usr/bin/env python
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2010-2025 German Aerospace Center (DLR) and others.
4
# This program and the accompanying materials are made available under the
5
# terms of the Eclipse Public License 2.0 which is available at
6
# https://www.eclipse.org/legal/epl-2.0/
7
# This Source Code may also be made available under the following Secondary
8
# Licenses when the conditions for such availability set forth in the Eclipse
9
# Public License 2.0 are satisfied: GNU General Public License, version 2
10
# or later which is available at
11
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14
# @file longpath.py
15
# @author Michael Behrisch
16
# @date 2024-08-28
17
18
import winreg
19
20
kr = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SYSTEM\CurrentControlSet\Control\FileSystem")
21
value, type_id = winreg.QueryValueEx(kr, "LongPathsEnabled")
22
if value == 0:
23
kw = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
24
r"SYSTEM\CurrentControlSet\Control\FileSystem", access=winreg.KEY_WRITE)
25
winreg.SetValueEx(kw, "LongPathsEnabled", None, type_id, 1)
26
print("Registry value for long path names successfully set.")
27
else:
28
print("Long path names are already enabled in the registry.")
29
30