swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
708 stars 47 forks source link

Verify Developer mode is set on Windows before running extension #805

Closed adam-fowler closed 2 weeks ago

adam-fowler commented 1 month ago

@compnerd, @tristanlabelle Is there an easy way to find this out?

compnerd commented 1 month ago

What is it precisely that you are after? Developer Mode not being enabled doesn't prevent the functioning of the extension. I wonder what exactly you are trying to determine.

tristanlabelle commented 1 month ago

I believe this comes from seeing that the lack of developer mode breaks testing functionality due to the missing symlink.

Developer mode can be tested through a registry key: https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging#use-regedit-to-enable-your-device . This NPM package could be used: https://www.npmjs.com/package/regedit

compnerd commented 1 month ago

If it is just symbolic link support, I think that querying for SeSymbolicLinkPrivilege should be checked for. Some people, including myself, do not enable Developer Mode, but do have the privilege which allows everything to work as expected.

adam-fowler commented 1 month ago

SeSymbolicLinkPrivilege

So what key and what value would I test for? Also are there instructions somewhere for an individual to enable this?

compnerd commented 1 month ago

There are instructions at https://portal.perforce.com/s/article/3472 (and various other sites, including the steps I've posted to the forums previously).

SeCreateSymbolicLinkPrivilege would be the key - that is the privilege itself that needs to be checked for. https://github.com/microsoft/Windows-classic-samples/blob/1d363ff4bd17d8e20415b92e2ee989d615cc0d91/Samples/ManagementInfrastructure/cpp/Process/Provider/WindowsProcess.c has an example of how to enable the privilege and should be helpful for determining how to check the privilege (just need to check the attributes for SE_PRIVILEGE_ENABLED I believe).

award999 commented 2 weeks ago

Verified with e548b63188333a84ade036e183a2b90656d64b4f