[libcxx-commits] [libcxx] [libcxx][test] Create feature host-can-create-symlinks (PR #82204)
Rodrigo Salazar via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Feb 18 21:05:46 PST 2024
================
@@ -474,6 +476,36 @@ def _getAndroidDeviceApi(cfg):
),
]
+# Creation of symlinks require elevated privileges on Windows unless
+# Windows developer mode is enabled.
+def check_unprivileged_symlinks(cfg):
+ if not platform.system().lower().startswith("windows"):
+ return True
+
+ temp_file = tempfile.NamedTemporaryFile(delete=False)
+ temp_file_path = temp_file.name
+
+ # Close the file to ensure it can be linked.
+ temp_file.close()
+
+ symlink_file_path = temp_file_path + "_symlink"
+ try:
+ os.symlink(temp_file_path, symlink_file_path)
+ return True
+ except Exception as e:
----------------
4-rodrigo-salazar wrote:
Yea that's probably a better choice, I'll scope this exception catch to just OSError.
https://github.com/llvm/llvm-project/pull/82204
More information about the libcxx-commits
mailing list